Skip to content

Commit

Permalink
Fix illegal memory access when parsing null-terminated string
Browse files Browse the repository at this point in the history
  • Loading branch information
Didik Setiawan authored and rockdaboot committed Apr 4, 2017
1 parent 89a5245 commit a07a8c0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libwget/robots.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,15 @@ ROBOTS *wget_robots_parse(const char *data, const char *client)
robots->paths = wget_vector_create(32, -2, NULL);
wget_vector_set_destructor(robots->paths, (wget_vector_destructor_t)_free_path);
}
for (p = data; !isspace(*p); p++);
for (p = data; *p && !isspace(*p); p++);
path.len = p - data;
path.path = wget_strmemdup(data, path.len);
wget_vector_add(robots->paths, &path, sizeof(path));
}
}
else if (!wget_strncasecmp_ascii(data, "Sitemap:", 8)) {
for (data += 8; *data==' ' || *data == '\t'; data++);
for (p = data; !isspace(*p); p++);
for (p = data; *p && !isspace(*p); p++);

if (!robots->sitemaps)
robots->sitemaps = wget_vector_create(4, -2, NULL);
Expand Down

0 comments on commit a07a8c0

Please sign in to comment.