summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/request.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/request.c b/src/request.c
index fd868f8..644cd4b 100644
--- a/src/request.c
+++ b/src/request.c
@@ -35,18 +35,26 @@ struct LibHTTPC_Request *LibHTTPC_loadRequest(struct LibHTTPC_Request *request_b
     request_buf->method = request_buf->buf = buf;
 
     next = strchr(request_buf->method, ' ');
+    if (!next)
+        return NULL;
     *next = '\0';
     request_buf->uri = next + 1;
 
     next = strchr(request_buf->uri, ' ');
+    if (!next)
+        return NULL;
     *next = '\0';
     request_buf->version = next + 1;
 
     next = strstr(request_buf->version, "\r\n");
+    if (!next)
+        return NULL;
     *next++ = '\0';
 
     for (size_t i = 0; (next = strstr(next, "\r\n")); ++next, ++i)
     {
+        if (!next)
+            return NULL;
         *next = '\0';
         next += 2;
 
@@ -67,6 +75,8 @@ struct LibHTTPC_Request *LibHTTPC_loadRequest(struct LibHTTPC_Request *request_b
         {
             request_buf->headers[i].name = next;
             next = strchr(next, ':');
+            if (!next)
+                return NULL;
             *next++ = '\0';
             request_buf->headers[i].value = next;
         }