+2001-05-01 Ken Raeburn <raeburn@mit.edu>
+
+ * cmds.c (setpeer): Port number should be unsigned short. (Patch
+ from Garry Zacheiss.) Add upper-bound check in case short is not
+ exactly 16 bits. Don't truncate the port number before checking.
+
2001-04-27 Ezra Peisach <epeisach@mit.edu>
* ftp_var.h: Prototype for recvrequest() needs volatile
char *argv[];
{
char *host, *hookup();
- short port;
+ unsigned short port;
if (connected) {
printf("Already connected to %s, use close first.\n",
}
port = sp->s_port;
if (argc > 2) {
- port = atoi(argv[2]);
- if (port <= 0) {
+ int iport = atoi (argv[2]);
+ if (iport <= 0 || iport >= 65536) {
printf("%s: bad port number-- %s\n", argv[1], argv[2]);
printf ("usage: %s host-name [port]\n", argv[0]);
code = -1;
return;
}
- port = htons(port);
+ port = htons(iport);
}
host = hookup(argv[1], port);
if (host) {