diff options
author | Sami Kerola | 2012-10-02 22:15:18 +0200 |
---|---|---|
committer | Karel Zak | 2012-10-15 15:54:25 +0200 |
commit | 2e472189c1a818b83158e305140adbb03fdc29f9 (patch) | |
tree | 624c73486f9cf006f94ee9a0696fcb4a881bed05 /text-utils/pg.c | |
parent | swapon: clarify swapon.8 priority option (diff) | |
download | kernel-qcow2-util-linux-2e472189c1a818b83158e305140adbb03fdc29f9.tar.gz kernel-qcow2-util-linux-2e472189c1a818b83158e305140adbb03fdc29f9.tar.xz kernel-qcow2-util-linux-2e472189c1a818b83158e305140adbb03fdc29f9.zip |
pg: check numeric user inputs
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'text-utils/pg.c')
-rw-r--r-- | text-utils/pg.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/text-utils/pg.c b/text-utils/pg.c index 9ade866ed..fa5639be2 100644 --- a/text-utils/pg.c +++ b/text-utils/pg.c @@ -64,6 +64,7 @@ #include "widechar.h" #include "all-io.h" #include "closestream.h" +#include "strutils.h" #define READBUF LINE_MAX /* size of input buffer */ #define CMDBUF 255 /* size of command buffer */ @@ -1623,7 +1624,8 @@ main(int argc, char **argv) goto endargs; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case '0': - pagelen = atoi(argv[arg] + i); + pagelen = strtol_or_err(argv[arg] + 1, + _("failed to parse number of lines per page")); havepagelen = 1; goto nextarg; case 'c': @@ -1687,7 +1689,8 @@ endargs: /*NOTREACHED*/ case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case '0': - startline = atoi(argv[arg] + 1); + startline = strtol_or_err(argv[arg] + 1, + _("failed to parse number of lines per page")); break; case '/': searchfor = argv[arg] + 2; |