Browse Source

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

wip/unchecked-remove
Oswald Buddenhagen 6 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 );
else if (!strcasecmp( "PassCmd", cfg->cmd ))
server->pass_cmd = nfstrdup( cfg->val );
else if (!strcasecmp( "Port", cfg->cmd ))
server->sconf.port = parse_int( cfg );
else if (!strcasecmp( "Timeout", cfg->cmd ))
else if (!strcasecmp( "Port", cfg->cmd )) {
int port = parse_int( cfg );
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 );
else if (!strcasecmp( "PipelineDepth", cfg->cmd )) {
if ((server->max_in_progress = parse_int( cfg )) < 1) {

2
src/socket.h

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

Loading…
Cancel
Save