提交 cb1c88d4 编写于 作者: T Timo Teräs 提交者: Rich Felker

fix uninitialized scopeid in lookups from hosts file and ip literals

上级 878887c5
...@@ -24,7 +24,7 @@ int __lookup_ipliteral(struct address buf[static 1], const char *name, int famil ...@@ -24,7 +24,7 @@ int __lookup_ipliteral(struct address buf[static 1], const char *name, int famil
if (family != AF_INET) { if (family != AF_INET) {
char tmp[64]; char tmp[64];
char *p = strchr(name, '%'), *z; char *p = strchr(name, '%'), *z;
unsigned long long scopeid; unsigned long long scopeid = 0;
if (p && p-name < 64) { if (p && p-name < 64) {
memcpy(tmp, name, p-name); memcpy(tmp, name, p-name);
tmp[p-name] = 0; tmp[p-name] = 0;
...@@ -44,8 +44,8 @@ int __lookup_ipliteral(struct address buf[static 1], const char *name, int famil ...@@ -44,8 +44,8 @@ int __lookup_ipliteral(struct address buf[static 1], const char *name, int famil
if (!scopeid) return EAI_NONAME; if (!scopeid) return EAI_NONAME;
} }
if (scopeid > UINT_MAX) return EAI_NONAME; if (scopeid > UINT_MAX) return EAI_NONAME;
buf[0].scopeid = scopeid;
} }
buf[0].scopeid = scopeid;
return 1; return 1;
} }
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册