aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorAndreas Schwab2012-10-20 15:28:42 +0200
committerAndreas Schwab2012-10-20 15:28:42 +0200
commitcab4f71ebd565c2f7dc0f8d4987785926202bcde (patch)
tree01fd4bffe8404792fd423c1a72c2a559340eafe5 /lib-src
parentc95a42666388351563df91910a4fe791c12c7a1e (diff)
downloademacs-cab4f71ebd565c2f7dc0f8d4987785926202bcde.tar.gz
emacs-cab4f71ebd565c2f7dc0f8d4987785926202bcde.zip
* make-docfile.c (scan_lisp_file): Add bounds checking.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog4
-rw-r--r--lib-src/make-docfile.c23
2 files changed, 16 insertions, 11 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 07fd4658172..02561c4aa3a 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,7 @@
12012-10-20 Andreas Schwab <schwab@linux-m68k.org>
2
3 * make-docfile.c (scan_lisp_file): Add bounds checking.
4
12012-10-20 Eli Zaretskii <eliz@gnu.org> 52012-10-20 Eli Zaretskii <eliz@gnu.org>
2 6
3 Prevent silent omission of doc strings from uncompile Lisp files. 7 Prevent silent omission of doc strings from uncompile Lisp files.
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c
index 555a563d748..2f04f1c96f3 100644
--- a/lib-src/make-docfile.c
+++ b/lib-src/make-docfile.c
@@ -1108,24 +1108,25 @@ scan_lisp_file (const char *filename, const char *mode)
1108 follow the conventions of the doc strings expected by this 1108 follow the conventions of the doc strings expected by this
1109 function. These conventions are automatically followed by the 1109 function. These conventions are automatically followed by the
1110 byte compiler when it produces the .elc files. */ 1110 byte compiler when it produces the .elc files. */
1111 static struct { 1111 static const char *const uncompiled[] =
1112 const char *fn; 1112 {
1113 size_t fl; 1113 "loaddefs.el",
1114 } uncompiled[] = { 1114 "loadup.el",
1115 { "loaddefs.el", sizeof("loaddefs.el") - 1 }, 1115 "charprop.el"
1116 { "loadup.el", sizeof("loadup.el") - 1 }, 1116 };
1117 { "charprop.el", sizeof("charprop.el") - 1 }
1118 };
1119 int i, match; 1117 int i, match;
1120 size_t flen = strlen (filename); 1118 size_t flen = strlen (filename);
1121 1119
1122 if (generate_globals) 1120 if (generate_globals)
1123 fatal ("scanning lisp file when -g specified", 0); 1121 fatal ("scanning lisp file when -g specified", 0);
1124 if (!strcmp (filename + flen - 3, ".el")) 1122 if (flen > 3 && !strcmp (filename + flen - 3, ".el"))
1125 { 1123 {
1126 for (i = 0, match = 0; i < sizeof(uncompiled)/sizeof(uncompiled[0]); i++) 1124 for (i = 0, match = 0; i < sizeof (uncompiled) / sizeof (uncompiled[0]);
1125 i++)
1127 { 1126 {
1128 if (!strcmp (filename + flen - uncompiled[i].fl, uncompiled[i].fn)) 1127 if (strlen (uncompiled[i]) <= flen
1128 && !strcmp (filename + flen - strlen (uncompiled[i]),
1129 uncompiled[i]))
1129 { 1130 {
1130 match = 1; 1131 match = 1;
1131 break; 1132 break;