<div dir="ltr">Merged, thanks!<div><br></div><div>J/r/mie</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 24, 2015 at 5:42 PM, Jonathan Rajotte <span dir="ltr"><<a href="mailto:jonathan.rajotte-julien@efficios.com" target="_blank">jonathan.rajotte-julien@efficios.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Ruled out cases: word, number+word, word+number, number+word+number<br>
Ex: foo, 123foo, foo123, 123foo123<br>
<br>
Signed-off-by: Jonathan Rajotte <<a href="mailto:jonathan.rajotte-julien@efficios.com">jonathan.rajotte-julien@efficios.com</a>><br>
---<br>
src/bin/lttng/commands/track-untrack.c | 8 ++++++--<br>
1 file changed, 6 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/bin/lttng/commands/track-untrack.c b/src/bin/lttng/commands/track-untrack.c<br>
index 52442cc..639e184 100644<br>
--- a/src/bin/lttng/commands/track-untrack.c<br>
+++ b/src/bin/lttng/commands/track-untrack.c<br>
@@ -96,6 +96,7 @@ int parse_pid_string(const char *_pid_string,<br>
int count = 0;<br>
int *pid_list = NULL;<br>
char *pid_string = NULL;<br>
+ char *endptr;<br>
<br>
if (all && _pid_string) {<br>
ERR("An empty PID string is expected with --all");<br>
@@ -132,13 +133,16 @@ int parse_pid_string(const char *_pid_string,<br>
while (one_pid_str != NULL) {<br>
unsigned long v;<br>
<br>
- v = strtoul(one_pid_str, NULL, 10);<br>
+ errno = 0;<br>
+ v = strtoul(one_pid_str, &endptr, 10);<br>
if ((v == 0 && errno == EINVAL)<br>
- || (v == ULONG_MAX && errno == ERANGE)) {<br>
+ || (v == ULONG_MAX && errno == ERANGE)<br>
+ || (*one_pid_str != '\0' && *endptr != '\0')){<br>
ERR("Error parsing PID %s", one_pid_str);<br>
retval = CMD_ERROR;<br>
goto error;<br>
}<br>
+<br>
if ((long) v > INT_MAX || (int) v < 0) {<br>
ERR("Invalid PID value %ld", (long) v);<br>
retval = CMD_ERROR;<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.1.4<br>
<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Jérémie Galarneau<br>EfficiOS Inc.<br><a href="http://www.efficios.com" target="_blank">http://www.efficios.com</a></div>
</div>