projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: Unchecked strdup return values in set_option
[lttng-tools.git]
/
src
/
bin
/
lttng-sessiond
/
main.c
diff --git
a/src/bin/lttng-sessiond/main.c
b/src/bin/lttng-sessiond/main.c
index 4d700d1e54130fae8ae19369e8bdc8e3b7ca7771..548cc43095b633bb09528085dfb878a5e99578f6 100644
(file)
--- a/
src/bin/lttng-sessiond/main.c
+++ b/
src/bin/lttng-sessiond/main.c
@@
-4199,6
+4199,10
@@
static int set_option(int opt, const char *arg, const char *optname)
break;
case 'g':
tracing_group_name = strdup(arg);
break;
case 'g':
tracing_group_name = strdup(arg);
+ if (!tracing_group_name) {
+ perror("strdup");
+ ret = -ENOMEM;
+ }
break;
case 'h':
usage();
break;
case 'h':
usage();
@@
-4253,22
+4257,42
@@
static int set_option(int opt, const char *arg, const char *optname)
break;
case 'u':
consumerd32_bin = strdup(arg);
break;
case 'u':
consumerd32_bin = strdup(arg);
+ if (!consumerd32_bin) {
+ perror("strdup");
+ ret = -ENOMEM;
+ }
consumerd32_bin_override = 1;
break;
case 'U':
consumerd32_libdir = strdup(arg);
consumerd32_bin_override = 1;
break;
case 'U':
consumerd32_libdir = strdup(arg);
+ if (!consumerd32_libdir) {
+ perror("strdup");
+ ret = -ENOMEM;
+ }
consumerd32_libdir_override = 1;
break;
case 't':
consumerd64_bin = strdup(arg);
consumerd32_libdir_override = 1;
break;
case 't':
consumerd64_bin = strdup(arg);
+ if (!consumerd64_bin) {
+ perror("strdup");
+ ret = -ENOMEM;
+ }
consumerd64_bin_override = 1;
break;
case 'T':
consumerd64_libdir = strdup(arg);
consumerd64_bin_override = 1;
break;
case 'T':
consumerd64_libdir = strdup(arg);
+ if (!consumerd64_libdir) {
+ perror("strdup");
+ ret = -ENOMEM;
+ }
consumerd64_libdir_override = 1;
break;
case 'p':
opt_pidfile = strdup(arg);
consumerd64_libdir_override = 1;
break;
case 'p':
opt_pidfile = strdup(arg);
+ if (!opt_pidfile) {
+ perror("strdup");
+ ret = -ENOMEM;
+ }
break;
case 'J': /* JUL TCP port. */
{
break;
case 'J': /* JUL TCP port. */
{
@@
-4297,6
+4321,10
@@
static int set_option(int opt, const char *arg, const char *optname)
break;
case 'P': /* probe modules list */
kmod_probes_list = strdup(arg);
break;
case 'P': /* probe modules list */
kmod_probes_list = strdup(arg);
+ if (!kmod_probes_list) {
+ perror("strdup");
+ ret = -ENOMEM;
+ }
break;
case 'f':
/* This is handled in set_options() thus silent break. */
break;
case 'f':
/* This is handled in set_options() thus silent break. */
This page took
0.033231 seconds
and
4
git commands to generate.