]> git.wh0rd.org Git - elf2flt.git/commitdiff
Allow for hex/octal/decimal stack specifications using the usual 0xNN,0NN,NN
authorDavid McCullough <davidm@snapgear.com>
Mon, 24 Sep 2007 05:11:48 +0000 (05:11 +0000)
committerDavid McCullough <davidm@snapgear.com>
Mon, 24 Sep 2007 05:11:48 +0000 (05:11 +0000)
notations.

elf2flt.c
flthdr.c

index 82015fcf2fdb79a89e1b08561b3f00e2764348f2..1cc6c03d26402a046d35dc5efaa2cbf5ee0ae6b1 100644 (file)
--- 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;
index 15301f539919e33a51932139e29421eaed72ca7d..b1277cac576af57c7885d0f228d3b247cc254f9c 100644 (file)
--- 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;