This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Fix -Wformat-length warning in tst-setgetname.c
- From: Tolga Dalman <tolga dot dalman at googlemail dot com>
- To: Steve Ellcey <sellcey at caviumnetworks dot com>, libc-alpha at sourceware dot org
- Date: Tue, 13 Dec 2016 01:11:42 +0100
- Subject: Re: [PATCH] Fix -Wformat-length warning in tst-setgetname.c
- Authentication-results: sourceware.org; auth=none
- References: <1477325277.8523.48.camel@caviumnetworks.com>
Hi Steve,
nice catch! Your fix is ok -- nitpicking now.
> #define FMT "/proc/self/task/%lu/comm"
> - char fname[sizeof (FMT) + 8];
> + char fname[sizeof (FMT) + 32];
+ 20 is sufficient. (actually 20 - sizeof("%lu"))
> sprintf (fname, FMT, (unsigned long) tid);
suggest to use snprintf instead.
Thanks
Tolga