From: Simon Horman Date: Wed, 13 Feb 2013 08:48:00 +0000 (+0900) Subject: BUG/MINOR: Correct logic in cut_crlf() X-Git-Tag: v1.5-dev18~99 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5269cfb4585ebee9babc628e2fed672c00028743;p=thirdparty%2Fhaproxy.git BUG/MINOR: Correct logic in cut_crlf() This corrects what appears to be logic errors in cut_crlf(). I assume that the intention of this function is to truncate a string at the first cr or lf. However, currently lf are ignored. Also use '\0' instead of 0 as the null character, a cosmetic change. Cc: Krzysztof Piotr Oledzki Signed-off-by: Simon Horman [WT: this fix may be backported to 1.4 too] --- diff --git a/include/common/standard.h b/include/common/standard.h index b1db8213bd..6946ded371 100644 --- a/include/common/standard.h +++ b/include/common/standard.h @@ -411,14 +411,14 @@ unsigned int inetaddr_host_lim_ret(char *text, char *stop, char **ret); static inline char *cut_crlf(char *s) { - while (*s != '\r' || *s == '\n') { + while (*s != '\r' && *s != '\n') { char *p = s++; if (!*p) return p; } - *s++ = 0; + *s++ = '\0'; return s; }