[PATCH] Enforce strict overflow checking

Jeremy Allison jra at samba.org
Tue Apr 3 21:55:13 UTC 2018


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.

> 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 :-).



More information about the samba-technical mailing list