[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: |
Samuel Thibault |
Subject: |
Re: [PATCH 3/7] name_equal: return early from function if src null-terminates in the loop |
Date: |
Mon, 16 Sep 2013 01:59:09 +0200 |
User-agent: |
Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) |
Marin Ramesa, le Fri 13 Sep 2013 13:31:53 +0200, a écrit :
> Return early from function if src null-terminates in the loop before
> the target does. This is to prevent pointers going to addresses beyond
> null-termination.
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
[PATCH 4/7] another small change in style for consistency, Marin Ramesa, 2013/09/13
[PATCH 5/7] remove preprocessor comments, Marin Ramesa, 2013/09/13
[PATCH 6/7] use boolean_t instead of an int, Marin Ramesa, 2013/09/13
[PATCH 7/7] another small change in style for consistency, Marin Ramesa, 2013/09/13
Re: Small cleanup of device name routines, Samuel Thibault, 2013/09/15