mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 22:31:28 +02:00
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 <ole@ans.pl> Signed-off-by: Simon Horman <horms@verge.net.au> [WT: this fix may be backported to 1.4 too]
This commit is contained in:
parent
f825580da8
commit
5269cfb458
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user