check for errors in sscanf

This commit is contained in:
Nikos Mavrogiannopoulos
2013-07-10 16:13:05 +02:00
parent 2af67c4aff
commit 8c15ad69f4

View File

@@ -88,7 +88,10 @@ char *unescape_url(const char *url, unsigned len, unsigned *out_len)
b[1] = url[pos + 2];
b[2] = 0;
sscanf(b, "%02x", &u);
if (sscanf(b, "%02x", &u) <= 0) {
free(msg);
return NULL;
}
msg[pos++] = u;
i += 3;