From: David McCullough Date: Mon, 24 Sep 2007 05:11:48 +0000 (+0000) Subject: Allow for hex/octal/decimal stack specifications using the usual 0xNN,0NN,NN X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=a644398ab861803dd190172f8871157b2a848a4e;p=elf2flt.git Allow for hex/octal/decimal stack specifications using the usual 0xNN,0NN,NN notations. --- diff --git a/elf2flt.c b/elf2flt.c index 82015fc..1cc6c03 100644 --- a/elf2flt.c +++ b/elf2flt.c @@ -1877,7 +1877,10 @@ int main(int argc, char *argv[]) use_resolved = 1; break; case 's': - stack = atoi(optarg); + if (sscanf(optarg, "%i", &stack) != 1) { + fprintf(stderr, "%s invalid stack size %s\n", argv[0], optarg); + usage(); + } break; case 'R': rel_file = optarg; diff --git a/flthdr.c b/flthdr.c index 15301f5..b1277ca 100644 --- a/flthdr.c +++ b/flthdr.c @@ -350,8 +350,11 @@ main(int argc, char *argv[]) case 'R': ramload = -1; break; case 'k': ktrace = 1; break; case 'K': ktrace = -1; break; - case 's': stacksize = atoi(optarg); break; case 'o': ofile = optarg; break; + case 's': + if (sscanf(optarg, "%i", &stacksize) != 1) + usage("invalid stack size"); + break; default: usage("invalid option"); break;