diff options
author | Marco d'Itri <md@linux.it> | 2014-01-19 23:50:07 +0100 |
---|---|---|
committer | Marco d'Itri <md@linux.it> | 2014-02-06 01:03:05 +0100 |
commit | 366ca9bcbe606c9c4be0bcfe11e1d75d89126be4 (patch) | |
tree | 92ee8e54c5b8b34990c42b9ca3c9c615eaf7b6df /mkpasswd.c | |
parent | d053b2f1f66a12516c40384dfffdf4253674871b (diff) | |
download | whois-366ca9bcbe606c9c4be0bcfe11e1d75d89126be4.tar.gz |
mkpasswd: fix an underflow in the parser for -R
Reported by mahkoh on github:
https://github.com/rfc1036/whois/issues/12
Diffstat (limited to 'mkpasswd.c')
-rw-r--r-- | mkpasswd.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -179,11 +179,14 @@ int main(int argc, char *argv[]) case 'R': { char *p; - rounds = strtol(optarg, &p, 10); - if (p == NULL || *p != '\0' || rounds < 0) { + long r; + + r = strtol(optarg, &p, 10); + if (p == NULL || *p != '\0' || r < 0) { fprintf(stderr, _("Invalid number '%s'.\n"), optarg); exit(1); } + rounds = r; } break; case 's': |