[PATCH 6/6] detect unterminated const arrays in strnlen calls (PR 86552)

Jeff Law law@redhat.com
Thu Aug 30 23:25:00 GMT 2018


On 08/13/2018 03:29 PM, Martin Sebor wrote:
> The attached changes implement the detection of past-the-end reads
> by strncpy due to unterminated arguments and excessive bounds.
> 
> 
> gcc-86552-6.diff
> 
> 
> PR tree-optimization/86552 - missing warning for reading past the end of non-string arrays
> 
> gcc/ChangeLog:
> 	* builtins.c (expand_builtin_strnlen): Detect, avoid expanding,
> 	and diagnose unterminated arrays.
> 
> gcc/testsuite/ChangeLog:
> 	* gcc.dg/warn-strnlen-no-nul.c: New.
This will have the same state and resolution as #2-#5.

jeff



More information about the Gcc-patches mailing list