From: Willy Tarreau Date: Wed, 22 Aug 2018 03:07:14 +0000 (+0200) Subject: MINOR: sample: remove impossible tests on negative smp->data.u.str.data X-Git-Tag: v1.9-dev2~122 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b509232eb835cd5ded1adfab25706365d68df976;p=thirdparty%2Fhaproxy.git MINOR: sample: remove impossible tests on negative smp->data.u.str.data Since commit 843b7cb ("MEDIUM: chunks: make the chunk struct's fields match the buffer struct") a chunk length is unsigned so we can remove negative size checks. --- diff --git a/include/proto/sample.h b/include/proto/sample.h index 6cca99a6a8..4fb5babf4d 100644 --- a/include/proto/sample.h +++ b/include/proto/sample.h @@ -92,8 +92,7 @@ int smp_is_safe(struct sample *smp) /* Fall through */ case SMP_T_STR: - if ((smp->data.u.str.data < 0) || - (smp->data.u.str.size && smp->data.u.str.data >= smp->data.u.str.size)) + if (smp->data.u.str.size && smp->data.u.str.data >= smp->data.u.str.size) return 0; if (smp->data.u.str.area[smp->data.u.str.data] == 0) @@ -106,8 +105,7 @@ int smp_is_safe(struct sample *smp) return 1; case SMP_T_BIN: - return (smp->data.u.str.data >= 0) && - (!smp->data.u.str.size || smp->data.u.str.data <= smp->data.u.str.size); + return !smp->data.u.str.size || smp->data.u.str.data <= smp->data.u.str.size; default: return 1; @@ -145,7 +143,6 @@ int smp_is_rw(struct sample *smp) case SMP_T_STR: if (!smp->data.u.str.size || - smp->data.u.str.data < 0 || smp->data.u.str.data >= smp->data.u.str.size) return 0; @@ -155,7 +152,6 @@ int smp_is_rw(struct sample *smp) case SMP_T_BIN: return smp->data.u.str.size && - smp->data.u.str.data >= 0 && smp->data.u.str.data <= smp->data.u.str.size; default: