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.
This commit is contained in:
Mikael Magnusson 2013-06-15 21:54:38 +02:00
parent 1947d8def8
commit 3c2cb65088
1 changed files with 1 additions and 1 deletions

View File

@ -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)