Skip to content

Commit

Permalink
Fix 'comparison is always false' / 'SIZEOF_SHORT undeclared' in dcc.c
Browse files Browse the repository at this point in the history
 Patch by: michaelortmann

* Fix 'comparison is always false' / 'SIZEOF_SHORT undeclared' in dcc.c
* forgot src/mod/module.h
  • Loading branch information
michaelortmann authored and vanosg committed Oct 12, 2018
1 parent 2d1fcc4 commit 5566319
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 10 deletions.
6 changes: 1 addition & 5 deletions src/dcc.c
Expand Up @@ -1250,7 +1250,7 @@ static int detect_telnet_flood(char *floodhost)


static void dcc_telnet(int idx, char *buf, int i) static void dcc_telnet(int idx, char *buf, int i)
{ {
unsigned short port; uint16_t port;
int j = 0, sock; int j = 0, sock;


if (dcc_total + 1 > max_dcc && increase_socks_max()) { if (dcc_total + 1 > max_dcc && increase_socks_max()) {
Expand All @@ -1273,11 +1273,7 @@ static void dcc_telnet(int idx, char *buf, int i)
/* Buffer data received on this socket. */ /* Buffer data received on this socket. */
sockoptions(sock, EGG_OPTION_SET, SOCK_BUFFER); sockoptions(sock, EGG_OPTION_SET, SOCK_BUFFER);


#if (SIZEOF_SHORT == 2)
if (port < 1024) { if (port < 1024) {
#else
if (port < 1024 || port > 65535) {
#endif
putlog(LOG_BOTS, "*", DCC_BADSRC, iptostr(&dcc[i].sockname.addr.sa), port); putlog(LOG_BOTS, "*", DCC_BADSRC, iptostr(&dcc[i].sockname.addr.sa), port);
killsock(sock); killsock(sock);
lostdcc(i); lostdcc(i);
Expand Down
2 changes: 1 addition & 1 deletion src/mod/module.h
Expand Up @@ -187,7 +187,7 @@
#define egg_list_append ((int (*) ( struct list_type **, struct list_type *))global[74]) #define egg_list_append ((int (*) ( struct list_type **, struct list_type *))global[74])
#define egg_list_contains ((int (*) (struct list_type *, struct list_type *))global[75]) #define egg_list_contains ((int (*) (struct list_type *, struct list_type *))global[75])
/* 76 - 79 */ /* 76 - 79 */
#define answer ((int (*) (int, sockname_t *, unsigned short *, int))global[76]) #define answer ((int (*) (int, sockname_t *, uint16_t *, int))global[76])
#define getvhost ((void (*) (sockname_t *, int))global[77]) #define getvhost ((void (*) (sockname_t *, int))global[77])
/* was neterror() */ /* was neterror() */
#ifdef TLS #ifdef TLS
Expand Down
4 changes: 2 additions & 2 deletions src/mod/transfer.mod/transfer.c
Expand Up @@ -869,7 +869,7 @@ static void dcc_fork_send(int idx, char *x, int y)


static void dcc_get_pending(int idx, char *buf, int len) static void dcc_get_pending(int idx, char *buf, int len)
{ {
unsigned short port; uint16_t port;
int i; int i;


i = answer(dcc[idx].sock, &dcc[idx].sockname, &port, 1); i = answer(dcc[idx].sock, &dcc[idx].sockname, &port, 1);
Expand All @@ -885,7 +885,7 @@ static void dcc_get_pending(int idx, char *buf, int len)
#endif #endif
dcc[idx].sock = i; dcc[idx].sock = i;
dcc[idx].addr = 0; dcc[idx].addr = 0;
dcc[idx].port = (int) port; dcc[idx].port = port;
if (dcc[idx].sock == -1) { if (dcc[idx].sock == -1) {
dprintf(DP_HELP, TRANSFER_NOTICE_BAD_CONN, dcc[idx].nick, strerror(errno)); dprintf(DP_HELP, TRANSFER_NOTICE_BAD_CONN, dcc[idx].nick, strerror(errno));
putlog(LOG_FILES, "*", TRANSFER_LOG_BAD_CONN, dcc[idx].u.xfer->origname, putlog(LOG_FILES, "*", TRANSFER_LOG_BAD_CONN, dcc[idx].u.xfer->origname,
Expand Down
2 changes: 1 addition & 1 deletion src/net.c
Expand Up @@ -637,7 +637,7 @@ int open_listen(int *port)
* If port is not NULL, it points to an integer to hold the port number * If port is not NULL, it points to an integer to hold the port number
* of the caller. * of the caller.
*/ */
int answer(int sock, sockname_t *caller, unsigned short *port, int binary) int answer(int sock, sockname_t *caller, uint16_t *port, int binary)
{ {
int new_sock; int new_sock;
caller->addrlen = sizeof(caller->addr); caller->addrlen = sizeof(caller->addr);
Expand Down
2 changes: 1 addition & 1 deletion src/proto.h
Expand Up @@ -279,7 +279,7 @@ int setsockname(sockname_t *, char *, int, int);
int open_address_listen(sockname_t *); int open_address_listen(sockname_t *);
int open_telnet_raw(int, sockname_t *); int open_telnet_raw(int, sockname_t *);
int open_telnet(int, char *, int); int open_telnet(int, char *, int);
int answer(int, sockname_t *, unsigned short *, int); int answer(int, sockname_t *, uint16_t *, int);
int getdccaddr(sockname_t *, char *, size_t); int getdccaddr(sockname_t *, char *, size_t);
int getdccfamilyaddr(sockname_t *, char *, size_t, int); int getdccfamilyaddr(sockname_t *, char *, size_t, int);
void tputs(int, char *, unsigned int); void tputs(int, char *, unsigned int);
Expand Down

0 comments on commit 5566319

Please sign in to comment.