summaryrefslogtreecommitdiff
path: root/implicit.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2012-02-26 21:34:51 +0000
committerPaul Smith <psmith@gnu.org>2012-02-26 21:34:51 +0000
commit6405534814f04899890a2d932db9a4985fd772fe (patch)
tree35e2b1fa9d9a5e7f334efc59c1e8d2e19fcebb2d /implicit.c
parentc0751bd3fce253f09b4ebe2aed1c70bcbbc6ad20 (diff)
downloadgunmake-6405534814f04899890a2d932db9a4985fd772fe.tar.gz
Check for possible buffer overflow on very long filenames.
Fixes Savannah bug #35525
Diffstat (limited to 'implicit.c')
-rw-r--r--implicit.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/implicit.c b/implicit.c
index 96c7b2b..c5f7481 100644
--- a/implicit.c
+++ b/implicit.c
@@ -488,6 +488,13 @@ pattern_search (struct file *file, int archive,
dir = pathdir;
}
+ if (stemlen > GET_PATH_MAX)
+ {
+ DBS (DB_IMPLICIT, (_("Stem too long: `%.*s'.\n"),
+ (int) stemlen, stem));
+ continue;
+ }
+
DBS (DB_IMPLICIT, (_("Trying pattern rule with stem `%.*s'.\n"),
(int) stemlen, stem));