File: 0001_buffer-overflow

package info (click to toggle)
vectoroids 1.1.0-16
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 784 kB
  • sloc: ansic: 2,178; makefile: 88; sh: 49
file content (26 lines) | stat: -rw-r--r-- 896 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Description: Buffer overflow in vectoroids
 Whilst performing a minimal source code audit of vectoroids I
 discovered that it contains a buffer overflow condition - because
 it doesn't test the length of one of the environmental variables
 it uses.
Bug-Debian: http://bugs.debian.org/203255
Author: Steve Kemp <skx@debian.org>
Reviewed-by: Christian T. Steigies <cts@debian.org>
Last-Update: 2003-07-28
--- a/vectoroids.c
+++ b/vectoroids.c
@@ -596,8 +596,12 @@
 #ifndef _WIN32
   /* snprintf(statefile, sizeof(statefile), "%s/.vectoroids-state",
 	   getenv("HOME")); */
-  sprintf(statefile, "%s/.vectoroids-state",
-	   getenv("HOME"));
+  if (getenv("HOME") != NULL )
+    {
+      memset(statefile, '\0', sizeof(statefile));
+      snprintf(statefile,sizeof(statefile)-1, "%s/.vectoroids-state",
+	       getenv("HOME"));
+    }
 #else
   sprintf(statefile, "vectoroids-state.dat");
 #endif