Fix: missing memset 0 and NULL byte in string
authorDavid Goulet <dgoulet@efficios.com>
Wed, 12 Mar 2014 20:31:32 +0000 (16:31 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Wed, 12 Mar 2014 20:31:32 +0000 (16:31 -0400)
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/bin/lttng-sessiond/save.c

index 22fab9c05bd013020a83c368fc6a0cadf7ad09e3..fd6c5d894e6f9a7ef099ba3a01088bb114bd870b 100644 (file)
@@ -1410,6 +1410,7 @@ int save_session(struct ltt_session *session,
        assert(creds);
 
        session_name_len = strlen(session->name);
+       memset(config_file_path, 0, sizeof(config_file_path));
 
        if (!session_access_ok(session,
                LTTNG_SOCK_GET_UID_CRED(creds),
@@ -1420,6 +1421,7 @@ int save_session(struct ltt_session *session,
 
        provided_path = lttng_save_session_attr_get_output_url(attr);
        if (provided_path) {
+               DBG3("Save session in provided path %s", provided_path);
                len = strlen(provided_path);
                if (len >= sizeof(config_file_path)) {
                        ret = LTTNG_ERR_SET_URL;
@@ -1472,6 +1474,8 @@ int save_session(struct ltt_session *session,
        strncpy(config_file_path + len, session->name, session_name_len);
        len += session_name_len;
        strcpy(config_file_path + len, DEFAULT_SESSION_CONFIG_FILE_EXTENSION);
+       len += sizeof(DEFAULT_SESSION_CONFIG_FILE_EXTENSION);
+       config_file_path[len] = '\0';
 
        if (!access(config_file_path, F_OK) && !attr->overwrite) {
                /* A file with the same name already exists, skip */
This page took 0.027313 seconds and 5 git commands to generate.