[Olsr-dev] [PATCH v1 095/115] info: http headers: add some asserts
Ferry Huberts
(spam-protected)
Wed Dec 2 21:29:08 CET 2015
From: Ferry Huberts <(spam-protected)>
Signed-off-by: Ferry Huberts <(spam-protected)>
---
lib/info/http_headers.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/lib/info/http_headers.c b/lib/info/http_headers.c
index bb29415..b6d7438 100644
--- a/lib/info/http_headers.c
+++ b/lib/info/http_headers.c
@@ -41,7 +41,14 @@
#include "http_headers.h"
+#include <assert.h>
+
void http_header_build(const char *plugin_name, const char *status, const char *mime, struct autobuf *abuf, int *contentLengthIndex) {
+ assert(plugin_name);
+ assert(status);
+ assert(abuf);
+ assert(contentLengthIndex);
+
/* Status */
abuf_appendf(abuf, "%s\r\n", status);
@@ -92,6 +99,8 @@ void http_header_build(const char *plugin_name, const char *status, const char *
void http_header_adjust_content_length(struct autobuf *abuf, int contentLengthIndex, int contentLength) {
char buf[12 + 1]; /* size must match to number of spaces used (+1 for the terminating byte) */
+ assert(abuf);
+
memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), "%d", contentLength);
buf[sizeof(buf) - 1] = '\0';
--
2.5.0
More information about the Olsr-dev
mailing list