Re: [PATCH] tools: perf: util: parse-events.c: Cleaning up missing null-terminate after strncpy call

From: Andi Kleen
Date: Wed Jun 04 2014 - 18:31:40 EST


On Thu, Jun 05, 2014 at 12:23:55AM +0200, Rickard Strandqvist wrote:
> Hi
>
> A little embarrassing, but I actually did not know that there was a
> better replacement for strncpy.

This works for perf, but not in general because standard glibc
does not have strlcpy. snprintf works always.

In practice if you could tolerate strncpy always zeroing
the complete string before you can also tolerate snprintf.

-Andi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/