summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-08-12 22:56:54 +0000
committerJakob Kaivo <jkk@ung.org>2019-08-12 22:56:54 +0000
commit74505b8cb07c050ebb801207633ffbeed5aeced3 (patch)
treecde21be52e25d8a045ca239e283d026631f79505
parentbb5ef54033e6eb3f26007a9d8e33a643b7dd90d1 (diff)
parentcb70a5616979f9632f4b12dc71c80916e8ef8196 (diff)
Merge branch 'fix-content-length-overflow' into 'master'
prevent buffer overflow when spoofing content-length See merge request jkaivo/blog!2
-rw-r--r--post.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/post.c b/post.c
index 3f4df04..27df0dc 100644
--- a/post.c
+++ b/post.c
@@ -47,7 +47,9 @@ void read_post_data(void)
int pos = 0;
int c;
- while ((c = getchar()) != EOF) {
+ buf[0] = '\0';
+
+ while (pos < cl && (c = getchar()) != EOF) {
if (c == '&') {
add_data(buf);
pos = 0;