Bug#31691: apt ftp bug fix
Here is my humble patch...
--- ftplib.cc.dist Thu Jul 30 23:57:02 1998
+++ ftplib.cc Mon Jan 11 00:51:50 1999
@@ -405,7 +405,11 @@
sin.sin_family = AF_INET;
lhost = strdup(host);
pnum = strchr(lhost,':');
- if (pnum == NULL)
+ if (pnum != NULL)
+ {
+ *pnum = '\0';
+ }
+ if (pnum == NULL || pnum[1] == '\0')
{
#if defined(VMS)
sin.sin_port = htons(21);
@@ -420,12 +424,16 @@
}
else
{
- *pnum++ = '\0';
+ pnum++;
if (isdigit(*pnum))
sin.sin_port = htons(atoi(pnum));
else
{
- pse = getservbyname(pnum,"tcp");
+ if ((pse = getservbyname(pnum,"tcp")) == NULL)
+ {
+ if(ftplib_debug > 1) perror("getservbyname");
+ return 0;
+ }
sin.sin_port = pse->s_port;
}
}
Reply to: