Fix possible buffer overflow problem in default_player_spec on Unix (thanks Steve Kemp). * xconq.c (make_default_player_spec): Limit it to BUFSIZE -1. * xtconq.c (make_default_player_spec): Limit it to BUFSIZE -1. In due course, bump to xconq-7.4.1nb1.
25 lines
949 B
Text
25 lines
949 B
Text
$NetBSD: patch-ah,v 1.3 2003/07/30 10:52:36 kleink Exp $
|
|
|
|
--- x11/xconq.c.orig 2000-11-24 02:19:09.000000000 +0100
|
|
+++ x11/xconq.c 2003-07-30 12:41:28.000000000 +0200
|
|
@@ -136,14 +136,17 @@
|
|
default_player_spec = xmalloc(BUFSIZE);
|
|
default_player_spec[0] = '\0';
|
|
if (!empty_string(getenv("USER"))) {
|
|
- strcpy(default_player_spec, getenv("USER"));
|
|
+ strncpy(default_player_spec, getenv("USER"),
|
|
+ BUFSIZE - 2);
|
|
strcat(default_player_spec, "@");
|
|
}
|
|
if (!empty_string(raw_default_player_spec)
|
|
&& raw_default_player_spec[0] == '@') {
|
|
- strcat(default_player_spec, raw_default_player_spec);
|
|
+ strncat(default_player_spec, raw_default_player_spec,
|
|
+ BUFSIZE - strlen(default_player_spec) - 1);
|
|
} else if (!empty_string(getenv("DISPLAY"))) {
|
|
- strcat(default_player_spec, getenv("DISPLAY"));
|
|
+ strncat(default_player_spec, getenv("DISPLAY"),
|
|
+ BUFSIZE - strlen(default_player_spec) - 1);
|
|
}
|
|
}
|
|
|