Re: [PATCH] avoid assuming strncpy arrays are nul-terminated (PR 89664)

2019-03-19 Thread Jeff Law
On 3/19/19 12:37 PM, Martin Sebor wrote: > On 3/19/19 12:01 PM, Martin Sebor wrote: >> On 3/19/19 8:33 AM, Jeff Law wrote: >>> On 3/11/19 8:27 PM, Martin Sebor wrote: The -Wstringop-truncation handling for strncpy/stpncpy neglects to consider that character arrays tracked by the strlen pa

Re: [PATCH] avoid assuming strncpy arrays are nul-terminated (PR 89664)

2019-03-19 Thread Jeff Law
On 3/19/19 12:01 PM, Martin Sebor wrote: > On 3/19/19 8:33 AM, Jeff Law wrote: >> On 3/11/19 8:27 PM, Martin Sebor wrote: >>> The -Wstringop-truncation handling for strncpy/stpncpy neglects >>> to consider that character arrays tracked by the strlen pass >>> are not necessarily nul-terminated.  It 

Re: [PATCH] avoid assuming strncpy arrays are nul-terminated (PR 89664)

2019-03-19 Thread Martin Sebor
On 3/19/19 12:01 PM, Martin Sebor wrote: On 3/19/19 8:33 AM, Jeff Law wrote: On 3/11/19 8:27 PM, Martin Sebor wrote: The -Wstringop-truncation handling for strncpy/stpncpy neglects to consider that character arrays tracked by the strlen pass are not necessarily nul-terminated.  It unconditional

Re: [PATCH] avoid assuming strncpy arrays are nul-terminated (PR 89664)

2019-03-19 Thread Martin Sebor
On 3/19/19 8:33 AM, Jeff Law wrote: On 3/11/19 8:27 PM, Martin Sebor wrote: The -Wstringop-truncation handling for strncpy/stpncpy neglects to consider that character arrays tracked by the strlen pass are not necessarily nul-terminated.  It unconditionally adds one when computing the size of eac

Re: [PATCH] avoid assuming strncpy arrays are nul-terminated (PR 89664)

2019-03-19 Thread Jeff Law
On 3/11/19 8:27 PM, Martin Sebor wrote: > The -Wstringop-truncation handling for strncpy/stpncpy neglects > to consider that character arrays tracked by the strlen pass > are not necessarily nul-terminated.  It unconditionally adds > one when computing the size of each sequence to account for > the

[PATCH] avoid assuming strncpy arrays are nul-terminated (PR 89664)

2019-03-11 Thread Martin Sebor
The -Wstringop-truncation handling for strncpy/stpncpy neglects to consider that character arrays tracked by the strlen pass are not necessarily nul-terminated. It unconditionally adds one when computing the size of each sequence to account for the nul. This leads to false positive warnings when