diff options
author | Tom Dignan <tom@dignan.io> | 2019-08-04 23:36:22 -0400 |
---|---|---|
committer | Tom Dignan <tom@dignan.io> | 2019-08-09 18:16:31 -0400 |
commit | cb70a5616979f9632f4b12dc71c80916e8ef8196 (patch) | |
tree | cde21be52e25d8a045ca239e283d026631f79505 | |
parent | bb5ef54033e6eb3f26007a9d8e33a643b7dd90d1 (diff) |
prevent buffer overflow when spoofing content-length
-rw-r--r-- | post.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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; |