This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc: Avoid writing '\0' out of string's border
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Chen Gang <gang dot chen dot 5i5j at gmail dot com>
- Cc: dodji at redhat dot com, kcc at google dot com, dvyukov at google dot com, gcc-patches List <gcc-patches at gcc dot gnu dot org>, Jeff Law <law at redhat dot com>
- Date: Mon, 1 Sep 2014 10:41:51 +0200
- Subject: Re: [PATCH] libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc: Avoid writing '\0' out of string's border
- Authentication-results: sourceware.org; auth=none
- References: <53FE5EF6 dot 5030003 at gmail dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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