From 2b0be6bb82f0402e50c11bb72b41bd4ec9589a66 Mon Sep 17 00:00:00 2001 From: mbm Date: Thu, 3 Mar 2005 02:44:10 +0000 Subject: target/jffs2/blocksize.mk for setting block size (req. for wrt54g) squashfs removed in favor of squashfs-lzma git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@301 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/openwrt/trx.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'package/openwrt/trx.c') diff --git a/package/openwrt/trx.c b/package/openwrt/trx.c index d4ad60037..79a04026e 100644 --- a/package/openwrt/trx.c +++ b/package/openwrt/trx.c @@ -170,7 +170,12 @@ int main(int argc, char **argv) } break; case 'a': - n = atoi(optarg); + errno = 0; + n = strtoul(optarg, &e, 0); + if (errno || (e == optarg) || *e) { + fprintf(stderr, "illegal numeric string\n"); + usage(); + } if (cur_len & (n-1)) { n = n - (cur_len & (n-1)); memset(buf + cur_len, 0, n); @@ -178,7 +183,12 @@ int main(int argc, char **argv) } break; case 'b': - n = atoi(optarg); + errno = 0; + n = strtoul(optarg, &e, 0); + if (errno || (e == optarg) || *e) { + fprintf(stderr, "illegal numeric string\n"); + usage(); + } if (n < cur_len) { fprintf(stderr, "WARNING: current length exceeds -b %d offset\n",n); } else { -- cgit v1.2.3