From: Arran Cudbard-Bell Date: Fri, 29 Aug 2014 19:38:08 +0000 (+0200) Subject: Use memcp for string comparisons to be \0 safe X-Git-Tag: release_3_0_5~672 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f18efb089c54ca7dd69ce6eff19a3742a1bf228f;p=thirdparty%2Ffreeradius-server.git Use memcp for string comparisons to be \0 safe --- diff --git a/src/lib/valuepair.c b/src/lib/valuepair.c index dfea003adcc..9ba6e4bd46a 100644 --- a/src/lib/valuepair.c +++ b/src/lib/valuepair.c @@ -2261,6 +2261,7 @@ int paircmp_value(VALUE_PAIR const *one, VALUE_PAIR const *two) switch (one->da->type) { case PW_TYPE_ABINARY: case PW_TYPE_OCTETS: + case PW_TYPE_STRING: /* We use memcmp to be \0 safe */ { size_t length; @@ -2285,12 +2286,6 @@ int paircmp_value(VALUE_PAIR const *one, VALUE_PAIR const *two) } break; - case PW_TYPE_STRING: - fr_assert(one->vp_strvalue); - fr_assert(two->vp_strvalue); - compare = strcmp(one->vp_strvalue, two->vp_strvalue); - break; - /* * Short-hand for simplicity. */