* [lttng-dev] [PATCH lttng-tools 1/2] Fix: pids should be numbers only
@ 2015-07-24 21:42 Jonathan Rajotte
2015-07-24 21:43 ` [lttng-dev] [PATCH lttng-tools 2/2] Fix: do not spawn sessiond on track/untrack commands Jonathan Rajotte
2015-07-28 15:51 ` [lttng-dev] [PATCH lttng-tools 1/2] Fix: pids should be numbers only Jérémie Galarneau
0 siblings, 2 replies; 4+ messages in thread
From: Jonathan Rajotte @ 2015-07-24 21:42 UTC (permalink / raw)
Ruled out cases: word, number+word, word+number, number+word+number
Ex: foo, 123foo, foo123, 123foo123
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien at efficios.com>
---
src/bin/lttng/commands/track-untrack.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/bin/lttng/commands/track-untrack.c b/src/bin/lttng/commands/track-untrack.c
index 52442cc..639e184 100644
--- a/src/bin/lttng/commands/track-untrack.c
+++ b/src/bin/lttng/commands/track-untrack.c
@@ -96,6 +96,7 @@ int parse_pid_string(const char *_pid_string,
int count = 0;
int *pid_list = NULL;
char *pid_string = NULL;
+ char *endptr;
if (all && _pid_string) {
ERR("An empty PID string is expected with --all");
@@ -132,13 +133,16 @@ int parse_pid_string(const char *_pid_string,
while (one_pid_str != NULL) {
unsigned long v;
- v = strtoul(one_pid_str, NULL, 10);
+ errno = 0;
+ v = strtoul(one_pid_str, &endptr, 10);
if ((v == 0 && errno == EINVAL)
- || (v == ULONG_MAX && errno == ERANGE)) {
+ || (v == ULONG_MAX && errno == ERANGE)
+ || (*one_pid_str != '\0' && *endptr != '\0')){
ERR("Error parsing PID %s", one_pid_str);
retval = CMD_ERROR;
goto error;
}
+
if ((long) v > INT_MAX || (int) v < 0) {
ERR("Invalid PID value %ld", (long) v);
retval = CMD_ERROR;
--
2.1.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* [lttng-dev] [PATCH lttng-tools 2/2] Fix: do not spawn sessiond on track/untrack commands
2015-07-24 21:42 [lttng-dev] [PATCH lttng-tools 1/2] Fix: pids should be numbers only Jonathan Rajotte
@ 2015-07-24 21:43 ` Jonathan Rajotte
2015-07-27 15:42 ` Jérémie Galarneau
2015-07-28 15:51 ` [lttng-dev] [PATCH lttng-tools 1/2] Fix: pids should be numbers only Jérémie Galarneau
1 sibling, 1 reply; 4+ messages in thread
From: Jonathan Rajotte @ 2015-07-24 21:43 UTC (permalink / raw)
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien at efficios.com>
---
src/bin/lttng/lttng.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/bin/lttng/lttng.c b/src/bin/lttng/lttng.c
index 13c7732..4cc320c 100644
--- a/src/bin/lttng/lttng.c
+++ b/src/bin/lttng/lttng.c
@@ -432,7 +432,9 @@ static int check_args_no_sessiond(int argc, char **argv)
strncmp(argv[i], "--list-options", sizeof("--list-options")) == 0 ||
strncmp(argv[i], "--list-commands", sizeof("--list-commands")) == 0 ||
strncmp(argv[i], "version", sizeof("version")) == 0 ||
- strncmp(argv[i], "view", sizeof("view")) == 0) {
+ strncmp(argv[i], "view", sizeof("view")) == 0 ||
+ strncmp(argv[i], "track", sizeof("track")) == 0 ||
+ strncmp(argv[i], "untrack", sizeof("untrack")) == 0) {
return 1;
}
}
--
2.1.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* [lttng-dev] [PATCH lttng-tools 2/2] Fix: do not spawn sessiond on track/untrack commands
2015-07-24 21:43 ` [lttng-dev] [PATCH lttng-tools 2/2] Fix: do not spawn sessiond on track/untrack commands Jonathan Rajotte
@ 2015-07-27 15:42 ` Jérémie Galarneau
0 siblings, 0 replies; 4+ messages in thread
From: Jérémie Galarneau @ 2015-07-27 15:42 UTC (permalink / raw)
Hi Jonathan,
I have decided to apply a different fix which ensures that only the
"create" command actually spawns a session daemon.
https://github.com/lttng/lttng-tools/commit/92360082fd291a95695fb612d773ae1bb991c256
Thanks!
J?r?mie
On Fri, Jul 24, 2015 at 5:43 PM, Jonathan Rajotte <
jonathan.rajotte-julien at efficios.com> wrote:
> Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien at efficios.com>
> ---
> src/bin/lttng/lttng.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/bin/lttng/lttng.c b/src/bin/lttng/lttng.c
> index 13c7732..4cc320c 100644
> --- a/src/bin/lttng/lttng.c
> +++ b/src/bin/lttng/lttng.c
> @@ -432,7 +432,9 @@ static int check_args_no_sessiond(int argc, char
> **argv)
> strncmp(argv[i], "--list-options",
> sizeof("--list-options")) == 0 ||
> strncmp(argv[i], "--list-commands",
> sizeof("--list-commands")) == 0 ||
> strncmp(argv[i], "version",
> sizeof("version")) == 0 ||
> - strncmp(argv[i], "view", sizeof("view"))
> == 0) {
> + strncmp(argv[i], "view", sizeof("view"))
> == 0 ||
> + strncmp(argv[i], "track", sizeof("track"))
> == 0 ||
> + strncmp(argv[i], "untrack",
> sizeof("untrack")) == 0) {
> return 1;
> }
> }
> --
> 2.1.4
>
>
--
J?r?mie Galarneau
EfficiOS Inc.
http://www.efficios.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20150727/36d8a862/attachment.html>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [lttng-dev] [PATCH lttng-tools 1/2] Fix: pids should be numbers only
2015-07-24 21:42 [lttng-dev] [PATCH lttng-tools 1/2] Fix: pids should be numbers only Jonathan Rajotte
2015-07-24 21:43 ` [lttng-dev] [PATCH lttng-tools 2/2] Fix: do not spawn sessiond on track/untrack commands Jonathan Rajotte
@ 2015-07-28 15:51 ` Jérémie Galarneau
1 sibling, 0 replies; 4+ messages in thread
From: Jérémie Galarneau @ 2015-07-28 15:51 UTC (permalink / raw)
Merged, thanks!
J/r/mie
On Fri, Jul 24, 2015 at 5:42 PM, Jonathan Rajotte <
jonathan.rajotte-julien at efficios.com> wrote:
> Ruled out cases: word, number+word, word+number, number+word+number
> Ex: foo, 123foo, foo123, 123foo123
>
> Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien at efficios.com>
> ---
> src/bin/lttng/commands/track-untrack.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/src/bin/lttng/commands/track-untrack.c
> b/src/bin/lttng/commands/track-untrack.c
> index 52442cc..639e184 100644
> --- a/src/bin/lttng/commands/track-untrack.c
> +++ b/src/bin/lttng/commands/track-untrack.c
> @@ -96,6 +96,7 @@ int parse_pid_string(const char *_pid_string,
> int count = 0;
> int *pid_list = NULL;
> char *pid_string = NULL;
> + char *endptr;
>
> if (all && _pid_string) {
> ERR("An empty PID string is expected with --all");
> @@ -132,13 +133,16 @@ int parse_pid_string(const char *_pid_string,
> while (one_pid_str != NULL) {
> unsigned long v;
>
> - v = strtoul(one_pid_str, NULL, 10);
> + errno = 0;
> + v = strtoul(one_pid_str, &endptr, 10);
> if ((v == 0 && errno == EINVAL)
> - || (v == ULONG_MAX && errno == ERANGE)) {
> + || (v == ULONG_MAX && errno == ERANGE)
> + || (*one_pid_str != '\0' && *endptr !=
> '\0')){
> ERR("Error parsing PID %s", one_pid_str);
> retval = CMD_ERROR;
> goto error;
> }
> +
> if ((long) v > INT_MAX || (int) v < 0) {
> ERR("Invalid PID value %ld", (long) v);
> retval = CMD_ERROR;
> --
> 2.1.4
>
>
--
J?r?mie Galarneau
EfficiOS Inc.
http://www.efficios.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20150728/9e8a345a/attachment.html>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-07-28 15:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-24 21:42 [lttng-dev] [PATCH lttng-tools 1/2] Fix: pids should be numbers only Jonathan Rajotte
2015-07-24 21:43 ` [lttng-dev] [PATCH lttng-tools 2/2] Fix: do not spawn sessiond on track/untrack commands Jonathan Rajotte
2015-07-27 15:42 ` Jérémie Galarneau
2015-07-28 15:51 ` [lttng-dev] [PATCH lttng-tools 1/2] Fix: pids should be numbers only Jérémie Galarneau
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox