Date: Wed, 11 May 2016 21:52:54 +0000 (UTC) From: Baptiste Daroussin <bapt@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r415038 - head/www/cgihtml/files Message-ID: <201605112152.u4BLqs5M031282@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bapt Date: Wed May 11 21:52:54 2016 New Revision: 415038 URL: https://svnweb.freebsd.org/changeset/ports/415038 Log: Prevent collision with getline(3) Modified: head/www/cgihtml/files/patch-cgi-lib.c Modified: head/www/cgihtml/files/patch-cgi-lib.c ============================================================================== --- head/www/cgihtml/files/patch-cgi-lib.c Wed May 11 21:51:01 2016 (r415037) +++ head/www/cgihtml/files/patch-cgi-lib.c Wed May 11 21:52:54 2016 (r415038) @@ -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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605112152.u4BLqs5M031282>