Fix: relayd relay_send_version: handle sscanf return code
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 26 Sep 2012 02:16:44 +0000 (22:16 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Wed, 26 Sep 2012 02:23:11 +0000 (22:23 -0400)
Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/bin/lttng-relayd/main.c

index d01491e9cbb400257892a913ee2aab590783b9af..dc6d2564a043abb44bb567d85a2a215d3317363f 100644 (file)
@@ -1265,7 +1265,7 @@ static
 int relay_send_version(struct lttcomm_relayd_hdr *recv_hdr,
                struct relay_command *cmd)
 {
-       int ret = htobe32(LTTNG_OK);
+       int ret;
        struct lttcomm_relayd_version reply;
        struct relay_session *session;
 
@@ -1284,7 +1284,12 @@ int relay_send_version(struct lttcomm_relayd_hdr *recv_hdr,
        }
        session->version_check_done = 1;
 
-       sscanf(VERSION, "%u.%u", &reply.major, &reply.minor);
+       ret = sscanf(VERSION, "%u.%u", &reply.major, &reply.minor);
+       if (ret < 2) {
+               ERR("Error in scanning version");
+               ret = -1;
+               goto end;
+       }
        reply.major = htobe32(reply.major);
        reply.minor = htobe32(reply.minor);
        ret = cmd->sock->ops->sendmsg(cmd->sock, &reply,
This page took 0.030803 seconds and 4 git commands to generate.