kore

An easy to use, scalable and secure web application framework for writing web APIs in C.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit 00a180c44583de03f347d41e0d7371cf1833124b
parent 2bf43fe5f800a75d4cf7050ddcc53c46b487e4e9
Author: Joris Vink <joris@coders.se>
Date:   Thu,  3 Jul 2014 20:21:05 +0200

Correct return value check for kore_task_channel_read().

The data we're using are not NUL-terminated strings.

Diffstat:
contrib/examples/task_curl/example.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contrib/examples/task_curl/example.c b/contrib/examples/task_curl/example.c @@ -109,7 +109,7 @@ page_handler(struct http_request *req) * and should be treated carefully. */ len = kore_task_channel_read(req->task, result, sizeof(result)); - if (len >= sizeof(result)) { + if (len > sizeof(result)) { http_response(req, 500, NULL, 0); } else { http_response(req, 200, result, len); @@ -167,7 +167,7 @@ run_curl(struct kore_task *t) * that was written to it by page_handler(). */ len = kore_task_channel_read(t, user, sizeof(user)); - if (len >= sizeof(user)) + if (len > sizeof(user)) return (KORE_RESULT_ERROR); l = snprintf(fields, sizeof(fields), "user=%.*s", len, user);