diff options
| author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2000-05-19 09:45:42 +0000 |
|---|---|---|
| committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2000-05-19 09:45:42 +0000 |
| commit | 6efb30c8d0f5d094d8fcbf11f38a2731078f8735 (patch) | |
| tree | 9005fcf46893321fa26cdf3d227358aa59c8d985 /lib/libfetch/ftp.c | |
| parent | 6ad135868c5f5a2dc6506075ff6145a278424335 (diff) | |
Notes
Diffstat (limited to 'lib/libfetch/ftp.c')
| -rw-r--r-- | lib/libfetch/ftp.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/libfetch/ftp.c b/lib/libfetch/ftp.c index fab45f5ceff8..9eb052d82d32 100644 --- a/lib/libfetch/ftp.c +++ b/lib/libfetch/ftp.c @@ -100,7 +100,8 @@ static size_t lr_size, lr_length; static int last_code; #define isftpreply(foo) (isdigit(foo[0]) && isdigit(foo[1]) \ - && isdigit(foo[2]) && foo[3] == ' ') + && isdigit(foo[2]) \ + && (foo[3] == ' ' || foo[3] == '\0')) #define isftpinfo(foo) (isdigit(foo[0]) && isdigit(foo[1]) \ && isdigit(foo[2]) && foo[3] == '-') @@ -238,11 +239,13 @@ _ftp_transfer(int cd, char *oper, char *file, * is IMHO the one and only weak point in the FTP protocol. */ ln = last_reply; - for (p = ln + 3; !isdigit(*p); p++) + for (p = ln + 3; *p && !isdigit(*p); p++) /* nothing */ ; - for (p--, i = 0; i < 6; i++) { - p++; /* skip the comma */ + for (i = 0; *p, i < 6; i++, p++) addr[i] = strtol(p, &p, 10); + if (i < 6) { + e = 999; + goto ouch; } /* seek to required offset */ |
