diff options
author | Darren Tucker <dtucker@cvs.openbsd.org> | 2017-12-05 23:59:48 +0000 |
---|---|---|
committer | Darren Tucker <dtucker@cvs.openbsd.org> | 2017-12-05 23:59:48 +0000 |
commit | 3306b28a3338457525da6290e4a9fb473be6db74 (patch) | |
tree | 7aa733adf0c0f567167a2138ac33711152103628 /usr.bin/ssh/servconf.c | |
parent | f7b6a1153596a4f6d0541a18798fa74a2686b9cb (diff) |
Replace atoi and strtol conversions for integer arguments to config
keywords with a checking wrapper around strtonum. This will prevent
and flag invalid and negative arguments to these keywords. ok djm@
Diffstat (limited to 'usr.bin/ssh/servconf.c')
-rw-r--r-- | usr.bin/ssh/servconf.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/ssh/servconf.c b/usr.bin/ssh/servconf.c index e56dd51cf80..388bc322757 100644 --- a/usr.bin/ssh/servconf.c +++ b/usr.bin/ssh/servconf.c @@ -1,5 +1,5 @@ -/* $OpenBSD: servconf.c,v 1.321 2017/12/05 23:56:07 dtucker Exp $ */ +/* $OpenBSD: servconf.c,v 1.322 2017/12/05 23:59:47 dtucker Exp $ */ /* * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * All rights reserved @@ -1095,6 +1095,7 @@ process_server_config_line(ServerOptions *options, char *line, size_t len; long long val64; const struct multistate *multistate_ptr; + const char *errstr; /* Strip trailing whitespace. Allow \f (form feed) at EOL only */ if ((len = strlen(line)) == 0) @@ -1378,10 +1379,9 @@ process_server_config_line(ServerOptions *options, char *line, intptr = &options->x11_display_offset; parse_int: arg = strdelim(&cp); - if (!arg || *arg == '\0') - fatal("%s line %d: missing integer value.", - filename, linenum); - value = atoi(arg); + if ((errstr = atoi_err(arg, &value)) != NULL) + fatal("%s line %d: integer value %s.", + filename, linenum, errstr); if (*activep && *intptr == -1) *intptr = value; break; |