File: fix-edict-buffer-overflow.diff

package info (click to toggle)
kdrill 6.5deb2-13.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,392 kB
  • sloc: ansic: 7,640; makefile: 47
file content (15 lines) | stat: -rw-r--r-- 437 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
--- a/readfile.c
+++ b/readfile.c
@@ -533,6 +533,12 @@
 		/* Success! Set pointers appropriately */
 		newk->kdrill_index=nextindex;
 		translations[nextindex++] = newk;
+
+                if (nextindex >= MAXTRANSLATIONSALLOWED) {
+                    fprintf(stderr, "Too many entries in the edict file. Some entries were not read.");
+                    break;
+                }
+
 		if(lastk != NULL)
 		{
 			lastk->nextk = newk;