[PATCH] D20572: [profile] clean up file handling code
Xinliang David Li via llvm-commits
llvm-commits at lists.llvm.org
Tue May 24 15:07:49 PDT 2016
On Tue, May 24, 2016 at 2:54 PM, Matthias Braun <matze at braunis.de> wrote:
> MatzeB added a subscriber: MatzeB.
>
> ================
> Comment at: lib/profile/InstrProfilingFile.c:129
> @@ -112,1 +128,3 @@
> + if (NumHosts)
> + strncpy(lprofCurFilename.Hostname, HostStr, COMPILER_RT_MAX_HOSTLEN);
>
> ----------------
> Note that `strncpy` is a really silly function: If you actually happen to
> write n or more characters you will not have a terminating '\0'
> character... My personal rule is to never use `strncpy()` but something
> like `snprintf(buf, bufsize, "%s%s", one, two);`
>
>
heh -- I agree with you in general ;). Here it won't be a problem as the
source of the strncpy is produced with snprintf. Anyway I will do a follow
up to clean it more.
thanks,
David
>
> http://reviews.llvm.org/D20572
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160524/978a3ead/attachment.html>
More information about the llvm-commits
mailing list