[ltrace/f17] Check -n argument for validity

Petr Machata pmachata at fedoraproject.org
Thu May 3 18:11:08 UTC 2012


commit 29759cceebc065c6dfd80d05e85744731ec82836
Author: Petr Machata <pmachata at redhat.com>
Date:   Thu May 3 20:10:54 2012 +0200

    Check -n argument for validity

 ltrace-0.6.0-dash-n.patch |   26 ++++++++++++++++++++++++++
 ltrace.spec               |    8 +++++++-
 2 files changed, 33 insertions(+), 1 deletions(-)
---
diff --git a/ltrace-0.6.0-dash-n.patch b/ltrace-0.6.0-dash-n.patch
new file mode 100644
index 0000000..d411434
--- /dev/null
+++ b/ltrace-0.6.0-dash-n.patch
@@ -0,0 +1,26 @@
+diff --git a/options.c b/options.c
+index d5edc1a..8dce7f8 100644
+--- a/options.c
++++ b/options.c
+@@ -494,9 +494,19 @@ process_options(int argc, char **argv)
+ 		case 'L':
+ 			options.libcalls = 0;
+ 			break;
+-		case 'n':
+-			options.indent = atoi(optarg);
++		case 'n': {
++			char *endptr;
++			long int l = strtol(optarg, &endptr, 0);
++			/* Arbitrary cut-off.  Nobody needs to indent
++			 * more than, say, 8, anyway.  */
++			if (l < 0 || l > 20 || *optarg == 0 || *endptr != 0) {
++				fprintf(stderr, "Invalid argument to -n: '%s'."
++					"  Use integer 0..20.\n", optarg);
++				exit(1);
++			}
++			options.indent = (int)l;
+ 			break;
++		}
+ 		case 'o':
+ 			options.output = fopen(optarg, "w");
+ 			if (!options.output) {
diff --git a/ltrace.spec b/ltrace.spec
index a2ea24f..a740669 100644
--- a/ltrace.spec
+++ b/ltrace.spec
@@ -1,7 +1,7 @@
 Summary: Tracks runtime library calls from dynamically linked executables
 Name: ltrace
 Version: 0.6.0
-Release: 10%{?dist}
+Release: 11%{?dist}
 URL: http://ltrace.alioth.debian.org/
 License: GPLv2+
 Group: Development/Debuggers
@@ -29,6 +29,7 @@ Patch11: ltrace-0.6.0-vfork.patch
 Patch12: ltrace-0.6.0-thread-races.patch
 Patch13: ltrace-0.6.0-process-start.patch
 Patch14: ltrace-0.6.0-selinux.patch
+Patch15: ltrace-0.6.0-dash-n.patch
 
 %description
 Ltrace is a debugging program which runs a specified command until the
@@ -56,6 +57,7 @@ execution of processes.
 %patch12 -p1
 %patch13 -p1
 %patch14 -p1
+%patch15 -p1
 sed -i -e 's/-o root -g root//' Makefile.in
 
 %build
@@ -84,6 +86,10 @@ echo ====================TESTING END=====================
 %config(noreplace) %{_sysconfdir}/ltrace.conf
 
 %changelog
+* Thu May  3 2012 Petr Machata <pmachata at redhat.com> - 0.6.0-11
+- Check -n argument for validity
+- Resolves: #818529
+
 * Wed Apr 11 2012 Peter Robinson <pbrobinson at fedoraproject.org> - 0.6.0-10
 - Drop ExclusiveArch as all current Primary/Secondary Arches are supported
 


More information about the scm-commits mailing list