From: asterix Date: Mon, 3 Oct 2011 15:04:52 +0000 (+0000) Subject: Check if the return buffer is biggest enough. X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=e1ab084b6b7434979ca344270526934e2af508d9;p=bertos.git Check if the return buffer is biggest enough. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@5135 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/net/http.c b/bertos/net/http.c index 891c462b..dd4ee4fd 100644 --- a/bertos/net/http.c +++ b/bertos/net/http.c @@ -83,6 +83,9 @@ void http_decodeUri(const char *raw_buf, size_t raw_len, char *decodec_buf, size char value; for (size_t i = 0; i < raw_len; i++) { + if (!len) + return; + if (raw_buf[i] == '%') { if (i + 2 < raw_len) @@ -92,12 +95,14 @@ void http_decodeUri(const char *raw_buf, size_t raw_len, char *decodec_buf, size if (value) { *decodec_buf++ = value; + len--; i += 2; continue; } } } *decodec_buf++ = raw_buf[i]; + len--; } }