]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Ensure that an incorrectly formatted password file doesn't cause invalid memory access
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Wed, 18 Mar 2020 10:01:53 +0000 (10:01 +0000)
committerAnder Juaristi <a@juaristi.eus>
Mon, 23 Mar 2020 16:00:58 +0000 (17:00 +0100)
Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
lib/auth/psk_passwd.c

index 4bdb4e02c48dfb521b3034fd359660a4f3335ab7..a0427914f928982f3e734bccbc3843c196adeb74 100644 (file)
@@ -100,7 +100,8 @@ static bool username_matches(const gnutls_datum_t *username,
                i++;
        }
 
-       if (line[0] == '#') {
+       /* if format is in hex, e.g. #FAFAFA */
+       if (line[0] == '#' && line_size > 1) {
                hexline.data = (void *) &line[1];
                hexline.size = i - 1;