[PATCH] libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc: Avoid writing '\0' out of string's border

Jakub Jelinek jakub@redhat.com
Mon Sep 1 08:42:00 GMT 2014


On Thu, Aug 28, 2014 at 06:43:02AM +0800, Chen Gang wrote:
> 'max_len' is the maximized length of 'name', so for writing '\0' to
> "name[max_len]", it is out of string's border, need use "max_len - 1"
> instead of.

Depends on how the function's API is defined.
And, at least in GCC sources that function seems to be completely unused,
nothing calls it, so it is hard to guess what the API should be.

> 2014-08-27  Chen Gang  <gang.chen.5i5j@gmail.com>
> 
> 	* sanitizer_common/sanitizer_linux_libcdep.cc
> 	(SanitizerGetThreadName): Avoid writing '\0' out of string's
> 	border

	Jakub



More information about the Gcc-patches mailing list