bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 3/7] name_equal: return early from function if src null-termi


From: Marin Ramesa
Subject: Re: [PATCH 3/7] name_equal: return early from function if src null-terminates in the loop
Date: Mon, 16 Sep 2013 08:30:44 +0200

On 16.09.2013 01:59:09, Samuel Thibault wrote:
> 
> Mmm, let me unloop it a bit:
> 
> >         if (*src++ != *target++)
> >             return FALSE;
> >         if (*src == '\0' && *target != '\0')
> >             return FALSE;
> >         if (*src++ != *target++)
> >             return FALSE;
> 
> This shows that the case you added would be caught by the next
> iteration of the while loop anyway, so your patch does not seem to 
> change the behavior?
> 
> Samuel

Actually, it changes the behavior when the values at the memory 
locations beyond null-termination are equal. But this is probably a 
rare case, so I don't know if it justifies the modification.

Btw, my patch is only partial. Neal's version is much better.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]