Fix SVACE defects (LIB.INSECURE_STRNCMP) 84/316084/2 accepted/tizen/unified/20240820.005638 accepted/tizen/unified/dev/20240821.053440 accepted/tizen/unified/x/20240820.083139
authorSeungbae Shin <seungbae.shin@samsung.com>
Tue, 13 Aug 2024 10:36:38 +0000 (19:36 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Fri, 16 Aug 2024 06:25:22 +0000 (15:25 +0900)
[Version] 0.14.2
[Issue Type] SVACE

Change-Id: Ibf12f2e15fd72559b5ddeb0a5fef5269c50ec265

focus_server/mm_sound_mgr_focus.c
mm_sound_client.c
mm_sound_pa_client.c
packaging/libmm-sound.spec

index 5d7fbbe..161e735 100644 (file)
@@ -142,7 +142,7 @@ static int _mm_sound_mgr_focus_get_priority_from_stream_type(int *priority, cons
 
                for (i = 0; i < AVAIL_STREAMS_MAX; i++) {
                        if (g_stream_list.stream_types[i] &&
-                               !strncmp(g_stream_list.stream_types[i], stream_type, strlen(stream_type))) {
+                               !strncmp(g_stream_list.stream_types[i], stream_type, strlen(stream_type) + 1)) {
                                *priority = g_stream_list.priorities[i];
                                break;
                        }
index 8c9eb4b..8ca6e0c 100644 (file)
@@ -298,7 +298,7 @@ static bool device_is_match_type(const char *type, int mask)
        if (mask == DEVICE_TYPE_FLAGS || mask == 0)
                return true;
 
-       is_builtin = !strncmp(type, builtin_prefix, strlen(builtin_prefix));
+       is_builtin = !strncmp(type, builtin_prefix, strlen(builtin_prefix) + 1);
 
        if ((mask & MM_SOUND_DEVICE_TYPE_INTERNAL_FLAG) && (is_builtin))
                return true;
index a7278df..da6b5d4 100644 (file)
@@ -219,10 +219,8 @@ int mm_sound_pa_open(MMSoundHandleMode mode, int volume_config, pa_sample_spec *
 
        if (!s) {
                debug_error("Open pulseaudio handle has failed - %s", pa_strerror(err));
-               if (!strncmp(pa_strerror(err), "Access denied by security check", strlen(pa_strerror(err))))
-                       err = MM_ERROR_SOUND_PERMISSION_DENIED;
-               else
-                       err = MM_ERROR_SOUND_INTERNAL;
+               err = (err == PA_ERR_ACCESS) ?
+                       MM_ERROR_SOUND_PERMISSION_DENIED : MM_ERROR_SOUND_INTERNAL;
                goto fail;
        }
 
index 5141451..77932ce 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-sound
 Summary:    MMSound Package contains client lib and focus server binary
-Version:    0.14.1
+Version:    0.14.2
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0