Bug fix. insecure strncmp 76/314376/1 accepted/tizen_unified accepted/tizen_unified_dev accepted/tizen_unified_toolchain accepted/tizen_unified_x accepted/tizen_unified_x_asan tizen accepted/tizen/unified/20240712.160041 accepted/tizen/unified/dev/20240715.080538 accepted/tizen/unified/toolchain/20240812.132738 accepted/tizen/unified/x/20240715.042502 accepted/tizen/unified/x/asan/20240813.231026
authorJiyong <jiyong.min@samsung.com>
Thu, 11 Jul 2024 03:46:20 +0000 (12:46 +0900)
committerJiyong <jiyong.min@samsung.com>
Thu, 11 Jul 2024 03:46:20 +0000 (12:46 +0900)
 - fix svace issue (LIB.INSECURE_STRNCMP)

The problem that such using checks only prefix of string because null-terminator is not checked.
It may be source of vulnarability when using for compariso passwords.
Correct pattern should use strlen(arg) + 1.

Change-Id: Ib66d43aac119b265c462b0ba35519caa3885d631

common/mm_util_private.c
packaging/libmm-utility.spec

index d44cdee..2f9eb42 100644 (file)
@@ -46,7 +46,7 @@ int mm_util_safe_fopen(const char *path, const char *mode, FILE **fp)
                                mm_util_stderror("realpath failed");
                                return MM_UTIL_ERROR_NO_SUCH_FILE;
                        }
-                       if (strncmp(path, _realpath, strlen(path))) {
+                       if (strncmp(path, _realpath, strlen(path) + 1)) {
                                mm_util_error("file is symbolic link");
                                free(_realpath);
                                return MM_UTIL_ERROR_NO_SUCH_FILE;
index 7958d9d..e0682b2 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-utility
 Summary:    Multimedia Framework Utility Library
-Version:    0.4.24
+Version:    0.4.25
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0