Fix Coverity defects 21/242521/1 accepted/tizen/unified/20200828.121501 submit/tizen/20200827.104847
authorSeungbae Shin <seungbae.shin@samsung.com>
Thu, 27 Aug 2020 10:28:52 +0000 (19:28 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Thu, 27 Aug 2020 10:28:52 +0000 (19:28 +0900)
 - Unchecked return value (CHECKED_RETURN)
 - String not null terminated (STRING_NULL)

[Version] 13.0.31
[Issue Type] Vulnerability

Change-Id: I0e4b8c824c0d6dd9efe71d34d3576aa81453aa83

packaging/pulseaudio-modules-tizen.spec
src/acm.c
src/module-sound-player.c
src/subscribe-observer.c

index bc64475cdf36148d406bb7ed8279e26a613da9be..22646983a12cacab4793974935136cf87e931151 100644 (file)
@@ -1,6 +1,6 @@
 Name:             pulseaudio-modules-tizen
 Summary:          Pulseaudio modules for Tizen
-Version:          13.0.30
+Version:          13.0.31
 Release:          0
 Group:            Multimedia/Audio
 License:          LGPL-2.1+
index a0d07a75a10a4ab6a168c70e5b97437a44e8cad3..7f697c26d260cfe019dbe2c20d0f327a174a15be 100644 (file)
--- a/src/acm.c
+++ b/src/acm.c
@@ -558,13 +558,13 @@ static void msg_thread_func(void *userdata) {
         }
 
         if ((recv_len = recv(u->msg_fd, recv_msg , IPC_MAX_MSG_LEN, 0)) > 0) {
-            if (!strcmp(recv_msg, MSG_DRAIN_COMPLETE)) {
+            if (!strncmp(recv_msg, MSG_DRAIN_COMPLETE, IPC_MAX_MSG_LEN)) {
                 pa_log_debug("got drain complete signal [%s]", recv_msg);
                 pa_cond_signal(u->msg_cond, false);
-            } else if (!strcmp(recv_msg, MSG_SEND_PAUSE)) {
+            } else if (!strncmp(recv_msg, MSG_SEND_PAUSE, IPC_MAX_MSG_LEN)) {
                 pa_log_debug("got pause signal [%s]", recv_msg);
                 u->need_pause = true;
-            } else if (!strcmp(recv_msg, MSG_SEND_RESUME) && u->need_pause) {
+            } else if (!strncmp(recv_msg, MSG_SEND_RESUME, IPC_MAX_MSG_LEN) && u->need_pause) {
                 pa_log_debug("got resume signal [%s]", recv_msg);
                 u->need_pause = false;
                 pa_cond_signal(u->msg_cond, false);
index 03225442e08755a51fee207d5aff279ffc0b172d..5e60af2956fe6df7ea6a72fd2a769f5f03b10763 100644 (file)
@@ -733,11 +733,11 @@ static void io_event_callback(pa_mainloop_api *io, pa_io_event *e, int fd, pa_io
             pa_log_info("name(%s), role(%s), volume_gain_type(%s), method(%s)",
                     data.filename, data.role, data.volume_gain_type, data.method);
 
-            if (pa_streq(data.method, SOUND_PLAYER_METHOD_NAME_SIMPLE_PLAY))
+            if (pa_strneq(data.method, SOUND_PLAYER_METHOD_NAME_SIMPLE_PLAY, METHOD_LEN))
                 _simple_play(u, data.filename, data.role, data.volume_gain_type);
-            else if (pa_streq(data.method, SOUND_PLAYER_METHOD_NAME_SIMPLE_STOP))
+            else if (pa_strneq(data.method, SOUND_PLAYER_METHOD_NAME_SIMPLE_STOP, METHOD_LEN))
                 _simple_stop(u, data.filename);
-            else if (pa_streq(data.method, SOUND_PLAYER_METHOD_NAME_SIMPLE_STOP_ALL))
+            else if (pa_strneq(data.method, SOUND_PLAYER_METHOD_NAME_SIMPLE_STOP_ALL, METHOD_LEN))
                 _simple_stop_all(u);
             else
                 pa_log_error("Invalid method!!!");
index c565a36baacd86ef562d226d3665380a6ceb41a3..a8ec66a023f9b8767dd96040cbb3ed25d5f8bae4 100644 (file)
@@ -188,9 +188,9 @@ static int get_sender_pid(DBusConnection *c, DBusMessage *got_msg, uint32_t *_se
         return -1;
     }
 
-    dbus_message_append_args(msg,
+    pa_assert_se(dbus_message_append_args(msg,
                 DBUS_TYPE_STRING, &sender,
-                DBUS_TYPE_INVALID);
+                DBUS_TYPE_INVALID));
 
     dbus_error_init(&err);
     if (!(reply = dbus_connection_send_with_reply_and_block(c, msg, -1, &err))) {