summaryrefslogtreecommitdiff
path: root/post.c
diff options
context:
space:
mode:
authorTom Dignan <tom@dignan.io>2019-08-04 23:36:22 -0400
committerTom Dignan <tom@dignan.io>2019-08-09 18:16:31 -0400
commitcb70a5616979f9632f4b12dc71c80916e8ef8196 (patch)
treecde21be52e25d8a045ca239e283d026631f79505 /post.c
parentbb5ef54033e6eb3f26007a9d8e33a643b7dd90d1 (diff)
prevent buffer overflow when spoofing content-length
Diffstat (limited to 'post.c')
-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;