Browse Source

fix type of 'port' and check its range in config reader

wip/unchecked-remove
Oswald Buddenhagen 7 years ago
parent
commit
f698f16967
  1. 12
      src/drv_imap.c
  2. 2
      src/socket.h

12
src/drv_imap.c

@ -3132,9 +3132,15 @@ imap_parse_store( conffile_t *cfg, store_conf_t **storep )
server->pass = nfstrdup( cfg->val ); server->pass = nfstrdup( cfg->val );
else if (!strcasecmp( "PassCmd", cfg->cmd )) else if (!strcasecmp( "PassCmd", cfg->cmd ))
server->pass_cmd = nfstrdup( cfg->val ); server->pass_cmd = nfstrdup( cfg->val );
else if (!strcasecmp( "Port", cfg->cmd )) else if (!strcasecmp( "Port", cfg->cmd )) {
server->sconf.port = parse_int( cfg ); int port = parse_int( cfg );
else if (!strcasecmp( "Timeout", cfg->cmd )) if ((unsigned)port > 0xffff) {
error( "%s:%d: Invalid port number\n", cfg->file, cfg->line );
cfg->err = 1;
} else {
server->sconf.port = (ushort)port;
}
} else if (!strcasecmp( "Timeout", cfg->cmd ))
server->sconf.timeout = parse_int( cfg ); server->sconf.timeout = parse_int( cfg );
else if (!strcasecmp( "PipelineDepth", cfg->cmd )) { else if (!strcasecmp( "PipelineDepth", cfg->cmd )) {
if ((server->max_in_progress = parse_int( cfg )) < 1) { if ((server->max_in_progress = parse_int( cfg )) < 1) {

2
src/socket.h

@ -43,7 +43,7 @@ enum {
typedef struct { typedef struct {
char *tunnel; char *tunnel;
char *host; char *host;
int port; ushort port;
int timeout; int timeout;
#ifdef HAVE_LIBSSL #ifdef HAVE_LIBSSL
char *cert_file; char *cert_file;

Loading…
Cancel
Save