no more garbage in text file previews
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Thu, 15 Nov 2012 08:20:48 +0000 (08:20 +0000)
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Thu, 15 Nov 2012 08:20:48 +0000 (08:20 +0000)
ticket #1601

SVN revision: 79322

src/bin/e_widget_filepreview.c

index d1bcf30..653f8fc 100644 (file)
@@ -807,14 +807,14 @@ static void
 _e_wid_fprev_preview_txt_read(void *data __UNUSED__, Ecore_Thread *eth)
 {
    char *text;
-   char buf[FILEPREVIEW_TEXT_PREVIEW_SIZE];
+   char buf[FILEPREVIEW_TEXT_PREVIEW_SIZE + 1] = {0};
    FILE *f;
 
    text = ecore_thread_global_data_find("fprev_file");
    if (!text) return;
    f = fopen(text, "r");
    if (!f) return;
-   fread(buf, sizeof(char), sizeof(buf), f);
+   fread(buf, sizeof(char), FILEPREVIEW_TEXT_PREVIEW_SIZE, f);
    ecore_thread_feedback(eth, evas_textblock_text_utf8_to_markup(NULL, buf));
    fclose(f);
 }