[PATCH 1/6] libbb: Fix trim
Samuel Mendoza-Jonas
sam at mendozajonas.com
Wed May 9 06:52:56 UTC 2018
On Wed, 2018-05-09 at 08:31 +0200, Xabier Oneca -- xOneca wrote:
> Hi,
>
> 2018-05-08 8:30 GMT+02:00 Samuel Mendoza-Jonas <sam at mendozajonas.com>:
> > Commit 20077c14, "make trim() return pointer to terminating NULL",
> > avoids a superfluous store if the string doesn't need to be trimmed, but
> > accidentally returns a pointer to the end of the string.
>
> That's an intended behaviour that other code modified in the same
> commit relies upon.
Ah, I missed the change from void to char* - so udhcp_str2optset()
shouldn't be using the pointer returned by trim(), but saving the
original pointer value. Thanks for the correction, I'll fix that in V2.
>
> > Move the 's += len' statement to inside the if statement to make sure we
> > return a pointer to the start of the string.
>
>
> Then those other functions will have to be modified too...
>
> Cheers,
> Xabier Oneca_,,_
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
More information about the busybox
mailing list