summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRadoslaw Czerski <r.czerski@samsung.com>2016-04-12 18:08:31 +0200
committerRadoslaw Czerski <r.czerski@samsung.com>2016-04-12 18:08:31 +0200
commitbec551c7453661faad6cbccc0455c1c37c63bf8d (patch)
treec259f3065dbc824198ef532da6414ce76e4e3223
parentbb0089dcaecdd90dfee4493fe91386f843593809 (diff)
downloadindicator-win-bec551c7453661faad6cbccc0455c1c37c63bf8d.tar.gz
indicator-win-bec551c7453661faad6cbccc0455c1c37c63bf8d.tar.bz2
indicator-win-bec551c7453661faad6cbccc0455c1c37c63bf8d.zip
main: Use of vulnerable function fixed.
strerror -> strerror_r Change-Id: I9beb26e070605678f5a33e5dceaec0f126876075 Signed-off-by: Radoslaw Czerski <r.czerski@samsung.com>
-rw-r--r--src/main.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index a9af64f..ccc5efe 100644
--- a/src/main.c
+++ b/src/main.c
@@ -69,6 +69,8 @@
#define UNLOCK_ENABLED 0
#define TIMEOUT 5
+#define ERROR_MESSAGE_LEN 256
+
#ifdef HOME_KEY_EMULATION
/* Predefine string */
#define PROP_HWKEY_EMULATION "_HWKEY_EMULATION"
@@ -1062,15 +1064,21 @@ static bool app_create(void *data)
ret = sigemptyset(&act.sa_mask);
if (ret < 0) {
- _E("Failed to sigemptyset[%s]", strerror(errno));
+ char error_message[ERROR_MESSAGE_LEN] = {0,};
+ strerror_r(errno, error_message, ERROR_MESSAGE_LEN);
+ _E("Failed to sigemptyset[%s]", error_message);
}
ret = sigaddset(&act.sa_mask, SIGTERM);
if (ret < 0) {
- _E("Failed to sigaddset[%s]", strerror(errno));
+ char error_message[ERROR_MESSAGE_LEN] = {0,};
+ strerror_r(errno, error_message, ERROR_MESSAGE_LEN);
+ _E("Failed to sigaddset[%s]", error_message);
}
ret = sigaction(SIGTERM, &act, NULL);
if (ret < 0) {
- _E("Failed to sigaction[%s]", strerror(errno));
+ char error_message[ERROR_MESSAGE_LEN] = {0,};
+ strerror_r(errno, error_message, ERROR_MESSAGE_LEN);
+ _E("Failed to sigaction[%s]", error_message);
}
ret = _start_indicator(ad);