From 1f84a73a11bb9c3abc17f66a45c0ad29018e1899 Mon Sep 17 00:00:00 2001 From: Zack Brown Date: Mon, 24 Jul 2017 22:22:04 -0400 Subject: [PATCH 1/2] Scan should return output length this change will make scan return the length of the output string --- GoHttp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GoHttp.c b/GoHttp.c index 0324182..a05acca 100644 --- a/GoHttp.c +++ b/GoHttp.c @@ -202,7 +202,7 @@ int scan(char *input, char *output, int start, int max) break; } - return i; + return i - start; } From e4c9cca9ebd024ad71c7ccb72a23a3cf391732a9 Mon Sep 17 00:00:00 2001 From: Zack Brown Date: Tue, 25 Jul 2017 09:22:39 -0400 Subject: [PATCH 2/2] Return strlen(output) This make it more obvious what we are doing and also saves us from an "off by one" bug that I nearly inflicted on us. --- GoHttp.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/GoHttp.c b/GoHttp.c index a05acca..4261dd9 100644 --- a/GoHttp.c +++ b/GoHttp.c @@ -202,12 +202,9 @@ int scan(char *input, char *output, int start, int max) break; } - return i - start; + return strlen(output); } - - - int checkMime(char *extension, char *mime_type) { char *current_word = malloc(600);