From e1ab084b6b7434979ca344270526934e2af508d9 Mon Sep 17 00:00:00 2001 From: asterix Date: Mon, 3 Oct 2011 15:04:52 +0000 Subject: [PATCH] Check if the return buffer is biggest enough. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@5135 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/net/http.c | 5 +++++ 1 file changed, 5 insertions(+) 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--; } } -- 2.25.1