[gimp] app: don't potentially overread buffer



commit 3c2cb65088859db1299282aa0a7f11d56b95e955
Author: Mikael Magnusson <mikachu src gnome org>
Date:   Sat Jun 15 21:54:38 2013 +0200

    app: don't potentially overread buffer
    
    If a file has more than 4kB on the first line and starts with #!, then
    we would pass a non-null terminated string to strchr. Found by coverity.

 app/plug-in/gimpinterpreterdb.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/app/plug-in/gimpinterpreterdb.c b/app/plug-in/gimpinterpreterdb.c
index ee966d1..acbeb40 100644
--- a/app/plug-in/gimpinterpreterdb.c
+++ b/app/plug-in/gimpinterpreterdb.c
@@ -733,7 +733,7 @@ gimp_interpreter_db_resolve (GimpInterpreterDB  *db,
     return resolve_extension (db, program_path);
 
   memset (buffer, 0, sizeof (buffer));
-  len = read (fd, buffer, sizeof (buffer));
+  len = read (fd, buffer, sizeof (buffer) - 1); /* leave one nul at the end */
   close (fd);
 
   if (len <= 0)


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