Fix issues reported by klocwork.
authorLukasz Stanislawski <l.stanislaws@samsung.com>
Fri, 27 Feb 2015 14:28:35 +0000 (15:28 +0100)
committerLukasz Stanislawski <l.stanislaws@samsung.com>
Fri, 27 Feb 2015 14:28:35 +0000 (15:28 +0100)
Change-Id: I0086e87c62d144a2cca33e50a3ab3c7606712daf

src/screen_reader_spi.c
src/screen_reader_vconf.c
src/smart_notification.c

index a1960f2..039f7f8 100644 (file)
@@ -150,7 +150,7 @@ void spi_on_caret_move_cb(const AtspiEvent *event, void *user_data)
                }
              else
                {
-                  if(asprintf(&text_to_read, "%s", (char*)atspi_text_get_text(text_interface, caret_pos, caret_pos + 1, NULL)))
+                  if(asprintf(&text_to_read, "%s", (char*)atspi_text_get_text(text_interface, caret_pos, caret_pos + 1, NULL)) < 0)
                     {
                       ERROR(MEMORY_ERROR);
                       return;
index 67ab205..9b04af7 100644 (file)
@@ -44,7 +44,7 @@ bool set_langauge(Service_Data *sd, const char *new_language, int new_voice)
                                vi->voice_type == new_voice)
                {
                        DEBUG("str_cpy %s (%d) -> %s (%d)", sd->language, sd->voice_type, vi->language, vi->voice_type);
-                       strncpy(sd->language, vi->language, LAN_NAME - 1);
+                       snprintf(sd->language, LAN_NAME, "%s", vi->language);
                        sd->voice_type = vi->voice_type;
                        DEBUG("after_str_cpy");
 
index 4cfe3cf..902d9c3 100644 (file)
@@ -175,7 +175,7 @@ static void _smart_notification_realized_items(int start_idx, int end_idx)
 
     char buf[256];
 
-    sprintf(buf, ITEMS_NOTIFICATION, start_idx, end_idx);
+    snprintf(buf, sizeof(buf), ITEMS_NOTIFICATION, start_idx, end_idx);
 
     tts_speak(strdup(buf), EINA_FALSE);
 }