]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: mech-digest-md5 - Do not read past buffer on right trim
authorAki Tuomi <aki.tuomi@open-xchange.com>
Tue, 12 May 2020 06:48:06 +0000 (09:48 +0300)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 13 May 2020 08:20:32 +0000 (11:20 +0300)
If the string does not have comma at the end, do not progress
the pointer past buffer end.

src/auth/mech-digest-md5.c

index 98057eb41017791141b295691f736fa7ef363b10..5f39ea5bb96d5c97af0febd10ec4f13024e7a0bb 100644 (file)
@@ -226,7 +226,10 @@ static bool parse_next(char **data, char **key, char **value)
                while (*p != '\0' && *p != ',')
                        p++;
 
-               *data = p+1;
+               *data = p;
+               /* If there is more to parse, ensure it won't get skipped
+                  because *p is set to NUL below */
+               if (**data != '\0') (*data)++;
                while (IS_LWS(p[-1]))
                        p--;
                *p = '\0';