summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2016-05-11 21:52:54 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2016-05-11 21:52:54 +0000
commit23acede28e9c046400dfff9518ee45fff983fd77 (patch)
tree569dd9080d1a89906da6a7c09c9195aea0fdfa2c
parentPrevent collision with get_line (diff)
Prevent collision with getline(3)
Notes
Notes: svn path=/head/; revision=415038
-rw-r--r--www/cgihtml/files/patch-cgi-lib.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/www/cgihtml/files/patch-cgi-lib.c b/www/cgihtml/files/patch-cgi-lib.c
index a15c8dc133ef..7be6a8bea884 100644
--- a/www/cgihtml/files/patch-cgi-lib.c
+++ b/www/cgihtml/files/patch-cgi-lib.c
@@ -30,6 +30,15 @@ retrieving revision 1.6
buffer = (char *)malloc(sizeof(char) * content_length + 1);
if (fread(buffer,sizeof(char),content_length,stdin) != content_length) {
/* consistency error. */
+@@ -181,7 +185,7 @@ int parse_CGI_encoded(llist *entries, ch
+
+ /* stolen from k&r and seriously modified to do what I want */
+
+-int getline(char s[], int lim)
++int get_line(char s[], int lim)
+ {
+ int c, i=0, num;
+
@@ -202,7 +206,7 @@ int getline(char s[], int lim)
int parse_form_encoded(llist* entries)
@@ -48,6 +57,18 @@ retrieving revision 1.6
else
return 0;
/* get boundary */
+@@ -231,9 +235,9 @@ int parse_form_encoded(llist* entries)
+ list_create(entries);
+ window = entries->head;
+ /* ignore first boundary; this isn't so robust; improve it later */
+- getline(buffer,BUFSIZ);
++ get_line(buffer,BUFSIZ);
+ /* now start parsing */
+- while ((bytesread=getline(buffer,BUFSIZ)) != 0) {
++ while ((bytesread=get_line(buffer,BUFSIZ)) != 0) {
+ start = 1;
+ /* this assumes that buffer contains no binary characters.
+ if the buffer contains the first valid header, then this
@@ -241,14 +245,20 @@ int parse_form_encoded(llist* entries)
robustness sake. */
buffer[bytesread] = '\0';
@@ -107,6 +128,24 @@ retrieving revision 1.6
/* null filename; for now, just don't save info. later, save
to default file */
isfile = 0;
+@@ -290,7 +299,7 @@ int parse_form_encoded(llist* entries)
+ else
+ isfile = 0;
+ /* ignore rest of headers and first blank line */
+- while (getline(buffer, BUFSIZ) > 1) {
++ while (get_line(buffer, BUFSIZ) > 1) {
+ /* DOS style blank line? */
+ if ((buffer[0] == '\r') && (buffer[1] == '\n'))
+ break;
+@@ -298,7 +307,7 @@ int parse_form_encoded(llist* entries)
+ done = 0;
+ j = 0;
+ while (!done) {
+- bytesread = getline(buffer,BUFSIZ);
++ bytesread = get_line(buffer,BUFSIZ);
+ buffer[bytesread] = '\0';
+ if (bytesread && strstr(buffer,boundary) == NULL) {
+ if (start) {
@@ -529,9 +538,9 @@ int parse_cookies(llist *entries)
int numcookies = 0;
short NM = 1;