pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/58578: pkgin(1) doesn't handle blanks in /usr/pkg/etc/pkgin/repositories.conf



The following reply was made to PR pkg/58578; it has been noted by GNATS.

From: RVP <rvp%SDF.ORG@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: pkg/58578: pkgin(1) doesn't handle blanks in
 /usr/pkg/etc/pkgin/repositories.conf
Date: Tue, 13 Aug 2024 05:03:30 +0000 (UTC)

 A smaller, less intrusive patch is:
 
 ```
 diff -urN pkgin-master.orig/fsops.c pkgin-master/fsops.c
 --- pkgin-master.orig/fsops.c	2024-06-12 14:37:20.000000000 +0000
 +++ pkgin-master/fsops.c	2024-08-13 04:50:24.205653579 +0000
 @@ -94,6 +94,11 @@
   		if (fgets(buf, BUFSIZ, fp) == NULL)
   			continue;
 
 +		char tb[sizeof buf];
 +		char* p = buf + strspn(buf, " \t");
 +		snprintf(tb, sizeof tb, "%.*s", (int)strcspn(p, " \t\r\n"), p);
 +		strcpy(buf, tb);
 +
   		if (strncmp(buf, "ftp://";, 6) != 0 &&
   			strncmp(buf, "http://";, 7) != 0 &&
   			strncmp(buf, "https://";, 8) != 0 &&
 @@ -121,7 +126,7 @@
   			}
   		}
 
 -		curlen = trimcr(buf) + 2; /* ' ' + '\0' */
 +		curlen = strlen(buf) + 2; /* ' ' + '\0' */
   		repolen += curlen;
 
   		repos = xrealloc(repos, repolen * sizeof(char));
 ```
 
 -RVP
 


Home | Main Index | Thread Index | Old Index