1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-28 01:06:17 +00:00

Prevent collision with getline(3)

This commit is contained in:
Baptiste Daroussin 2016-05-11 21:52:54 +00:00
parent 25269d65db
commit 23acede28e
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=415038

View File

@ -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;