[tracker-miners/wip/carlosg/coverity-fixes: 4/28] tracker-extract: Fix off by one




commit 0426f44ee2980859824b003c8d91ea8edff62f01
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Oct 24 00:10:06 2021 +0200

    tracker-extract: Fix off by one
    
    We are writing past the given buffer.
    
    CID: #366548

 src/tracker-extract/tracker-extract-disc-generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/src/tracker-extract/tracker-extract-disc-generic.c 
b/src/tracker-extract/tracker-extract-disc-generic.c
index d3956cf77..8daf45ea9 100644
--- a/src/tracker-extract/tracker-extract-disc-generic.c
+++ b/src/tracker-extract/tracker-extract-disc-generic.c
@@ -234,7 +234,7 @@ ps_disc_lookup_executable_filename (const gchar *content,
                ptr++;
 
        strncpy (exe_buffer, ptr, buffer_len);
-       exe_buffer[buffer_len] = '\0';
+       exe_buffer[buffer_len - 1] = '\0';
 
        /* Keep only the first line. */
        for (i = 0; i < buffer_len; i++) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]