Commit d85d95a4 authored by Alexander Alashkin's avatar Alexander Alashkin Committed by Cesanta Bot

Fix potential out-of-bound

PUBLISHED_FROM=71b40189bcedbe9338915c1aad939835125dad26
parent b5dd54a4
......@@ -1136,7 +1136,7 @@ struct mg_str mg_mk_str_n(const char *s, size_t len) {
int mg_vcmp(const struct mg_str *str1, const char *str2) WEAK;
int mg_vcmp(const struct mg_str *str1, const char *str2) {
size_t n2 = strlen(str2), n1 = str1->len;
int r = memcmp(str1->p, str2, (n1 < n2) ? n1 : n2);
int r = strncmp(str1->p, str2, (n1 < n2) ? n1 : n2);
if (r == 0) {
return n1 - n2;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment