fixed missing check for null after strdup in evutil_inet_pton_scope (#1366)
authorMichael Madsen <mkm85@users.noreply.github.com>
Fri, 4 Nov 2022 08:59:17 +0000 (01:59 -0700)
committerGitHub <noreply@github.com>
Fri, 4 Nov 2022 08:59:17 +0000 (11:59 +0300)
evutil.c

index ae862ee104b6f4588fb1bdfbf388a91468751a48..2876721a5e9b519bf60a2faa04f40aa3c7fa858e 100644 (file)
--- a/evutil.c
+++ b/evutil.c
@@ -2248,7 +2248,9 @@ evutil_inet_pton_scope(int af, const char *src, void *dst, unsigned *indexp)
                        return 0;
        }
        *indexp = if_index;
-       tmp_src = mm_strdup(src);
+       if (!(tmp_src = mm_strdup(src)) {
+               return -1;
+       }
        cp = strchr(tmp_src, '%');
        *cp = '\0';
        r = evutil_inet_pton(af, tmp_src, dst);