From: Sunzen Wang <sunzen@gmail.com>
To: systemtap@sources.redhat.com
Subject: [Patch 1/2] Enhance -s option checking to only accept valid size number
Date: Tue, 19 May 2009 01:07:00 -0000 [thread overview]
Message-ID: <da1db2080905181807r671ac138tacef57e090e0dcf9@mail.gmail.com> (raw)
Fix: Enhance -s option checking to only accept valid size number
---
diff --git a/main.cxx b/main.cxx
index 39d835d..ec5506f 100644
--- a/main.cxx
+++ b/main.cxx
@@ -626,8 +626,8 @@ main (int argc, char * const argv [])
break;
case 's':
- s.buffer_size = atoi (optarg);
- if (s.buffer_size < 1 || s.buffer_size > 4095)
+ s.buffer_size = (int) strtoul (optarg, &num_endptr, 10);
+ if (*num_endptr != '\0' || s.buffer_size < 1 || s.buffer_size > 4095)
{
cerr << "Invalid buffer size (should be 1-4095)." << endl;
usage (s, 1);
---
--
sunzen
<<freedom & enjoyment>>
reply other threads:[~2009-05-19 1:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=da1db2080905181807r671ac138tacef57e090e0dcf9@mail.gmail.com \
--to=sunzen@gmail.com \
--cc=systemtap@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).