From owner-svn-ports-head@freebsd.org Wed May 11 21:52:55 2016 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75454B37B16; Wed, 11 May 2016 21:52:55 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 284791BA3; Wed, 11 May 2016 21:52:55 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4BLqsl0031283; Wed, 11 May 2016 21:52:54 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4BLqs5M031282; Wed, 11 May 2016 21:52:54 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201605112152.u4BLqs5M031282@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Wed, 11 May 2016 21:52:54 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r415038 - head/www/cgihtml/files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 May 2016 21:52:55 -0000 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;