[PATCH] Enforce strict overflow checking

Stefan Metzmacher metze at samba.org
Tue Apr 3 21:59:28 UTC 2018


Am 03.04.2018 um 23:55 schrieb Jeremy Allison:
> On Tue, Apr 03, 2018 at 11:49:53PM +0200, Stefan Metzmacher wrote:
>> Am 03.04.2018 um 19:23 schrieb Jeremy Allison via samba-technical:
>>>
>>> Sure does. RB+ and pushed all except the last two patches
>>> that turn on the compiler shitches (or off in the nmbd
>>> case :-).
>>>
>>> I would like to get Metze's buy-off before pressing the
>>> final big red button (tm) :-).
>>
>> I would prefer that we fix the warning, this seems to do the trick
>> with gcc 4.8:
>>
>> diff --git a/source3/nmbd/nmbd_incomingrequests.c
>> b/source3/nmbd/nmbd_incomingrequests.c
>> index 6f3eee3..96cb124 100644
>> --- a/source3/nmbd/nmbd_incomingrequests.c
>> +++ b/source3/nmbd/nmbd_incomingrequests.c
>> @@ -341,7 +341,7 @@ subnet %s - name not found.\n",
>> nmb_namestr(&nmb->question.question_name),
>>
>>         namerec = subrec->namelist;
>>
>> -       while (buf < bufend) {
>> +       while (PTR_DIFF(bufend, buf) > 0) {
>>                 if( (namerec->data.source == SELF_NAME) ||
>> (namerec->data.source == PERMANENT_NAME) ) {
>>                         int name_type = namerec->name.name_type;
>>                         unstring name;
>>
>>
>> Can you double check it doesn't change the logic?
> 
> Will do.

Thanks!

>> But process_node_status_request() is a complete mess and should be
>> rewritten by someone who understands it:-)
> 
> Have a heart Metze, that's some very old code :-).

It's not required, just nice to have :-)

metze

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20180403/083868ee/signature.sig>


More information about the samba-technical mailing list