elm naviframe - fix buffer size handling and strncat
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Wed, 7 Nov 2018 16:59:05 +0000 (16:59 +0000)
committerSangHyeon Jade Lee <sh10233.lee@samsung.com>
Tue, 20 Nov 2018 06:56:20 +0000 (15:56 +0900)
strncat where the size passed is tghe size of the string is pointless.
it is strcat. so chekc before the strcat... and be simpler and honest

src/lib/elementary/elc_naviframe.c

index 9c150c4..a4a4ce8 100644 (file)
@@ -619,7 +619,8 @@ _elm_naviframe_item_elm_widget_item_part_text_set(Eo *eo_it,
      strncat(buf, nit->title_label, sizeof(buf) - 1);
    if (nit->subtitle_label)
      {
-        if (nit->title_label) strncat(buf, " ", 1);
+        if ((nit->title_label) && (strlen(buf) < (sizeof(buf) - 2)))
+          strcat(buf, " ");
         strncat(buf, nit->subtitle_label, sizeof(buf) - strlen(buf) - 2);
      }
    efl_access_object_i18n_name_set(eo_it, buf);