Fix the Svace issue 55/89555/1
authorHyuk Lee <hyuk0512.lee@samsung.com>
Mon, 26 Sep 2016 04:53:01 +0000 (13:53 +0900)
committerHyuk Lee <hyuk0512.lee@samsung.com>
Mon, 26 Sep 2016 04:53:01 +0000 (13:53 +0900)
- WGID : 58818

Change-Id: I3d88dbbeb5428fe57ab129e1f845fedd40ed3dc9
Signed-off-by: Hyuk Lee <hyuk0512.lee@samsung.com>
src/bt-syspopup-w.c
src/bt-syspopup-w.h

index c7e8bf9..79d4645 100644 (file)
@@ -844,12 +844,12 @@ char *__bluetooth_convert_rgba_to_hex(int r, int g, int b, int a)
        int hexcolor = 0;
        char* string = NULL;
 
-       string = g_try_malloc0(sizeof(char) * 255);
+       string = g_try_malloc0(sizeof(char) * BT_MAX_STR_LENGTH);
        if (string == NULL)
                return NULL;
 
        hexcolor = (r << 24) + (g << 16) + (b << 8) + a;
-       sprintf(string, "%08x", hexcolor);
+       snprintf(string, BT_MAX_STR_LENGTH, "%08x", hexcolor);
 
        return string;
 }
index f551df8..aba394d 100644 (file)
@@ -60,6 +60,7 @@
 #define BT_DEVICE_NAME_LENGTH_MAX 256
 #define BT_FILE_NAME_LENGTH_MAX 256
 #define BT_TEXT_EXTRA_LEN 20
+#define BT_MAX_STR_LENGTH 256
 
 #define BT_SET_FONT_SIZE       "<font_size=%d>%s</font_size>"
 #define BT_TITLE_FONT_30       30