Bug 28 - event/octeontx: snprintf() overflow
Summary: event/octeontx: snprintf() overflow
Status: RESOLVED FIXED
Alias: None
Product: DPDK
Classification: Unclassified
Component: eventdev (show other bugs)
Version: 18.05
Hardware: ARM All
: Normal normal
Target Milestone: 18.05
Assignee: Pavan Nikhilesh
URL: http://dpdk.org/commit/13573bd3
Depends on:
Blocks:
 
Reported: 2018-04-23 12:35 CEST by Harry van Haaren (Intel)
Modified: 2018-04-25 16:53 CEST (History)
2 users (show)



Attachments
Fix snprintf overflow (1.16 KB, patch)
2018-04-23 15:41 CEST, Pavan Nikhilesh
Details | Diff

Description Harry van Haaren (Intel) 2018-04-23 12:35:49 CEST
Compiling latest git with Meson and GCC 5.4, it prints a warning for always overflowing a destination buffer.

[1/15] Compiling C object 'drivers/tmp_rte_..._event@sta/event_octeontx_timvf_evdev.c.o'
In file included from /usr/include/stdio.h:936:0,
                 from ../lib/librte_eal/common/include/rte_log.h:21,
                 from ../lib/librte_eal/common/include/rte_debug.h:17,
                 from ../lib/librte_eal/common/include/generic/rte_cycles.h:16,
                 from ../lib/librte_eal/common/include/arch/x86/rte_cycles.h:13,
                 from ../drivers/event/octeontx/timvf_evdev.h:10,
                 from ../drivers/event/octeontx/timvf_evdev.c:6:
In function ‘snprintf’,
    inlined from ‘timvf_ring_create’ at ../drivers/event/octeontx/timvf_evdev.c:298:2:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:64:10: warning: call to __builtin___snprintf_chk will always overflow destination buffer
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,


/* Declaration of pool_name */
char pool_name[25];
...
/* offending line, note the mismatch in size 25 and 30 */
snprintf(pool_name, 30, "timvf_chunk_pool%d", timr->tim_ring_id);

Commited in f874c1eb1519185feba05a0542413492e5f56ae9
Comment 1 Pavan Nikhilesh 2018-04-23 15:41:23 CEST
Created attachment 5 [details]
Fix snprintf overflow
Comment 2 Harry van Haaren (Intel) 2018-04-23 16:35:11 CEST
Thanks @Pavan, attached patch fixes here.
Comment 3 Thomas Monjalon 2018-04-25 16:53:24 CEST
Fix applied:
http://dpdk.org/commit/13573bd3

Note You need to log in before you can comment on or make changes to this bug.