]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
func_curl: Don't trim response text on non-ASCII characters 92/2892/1
authorIvan Poddubny <ivan.poddubny@gmail.com>
Sat, 21 May 2016 10:42:45 +0000 (13:42 +0300)
committerIvan Poddubny <ivan.poddubny@gmail.com>
Sat, 21 May 2016 13:53:43 +0000 (08:53 -0500)
The characters 0x80-0xFF were trimmed as well as 0x00-0x20 because of
a signed comparison.

ASTERISK-25669 #close
Reported by: Jesper
patches:
  strings.curl.trim.patch submitted by Jesper (License 5518)

Change-Id: Ia51e169f24e3252a7ebbaab3728630138ec6f60a

include/asterisk/strings.h

index 0e2f69ba892578926b4d26199dec504619677e09..2ca75a69c471c65817163aaaf225abb085841882 100644 (file)
@@ -688,7 +688,7 @@ void ast_str_trim_blanks(struct ast_str *buf),
        if (!buf) {
                return;
        }
-       while (buf->__AST_STR_USED && buf->__AST_STR_STR[buf->__AST_STR_USED - 1] < 33) {
+       while (buf->__AST_STR_USED && ((unsigned char) buf->__AST_STR_STR[buf->__AST_STR_USED - 1]) < 33) {
                buf->__AST_STR_STR[--(buf->__AST_STR_USED)] = '\0';
        }
 }