changeset 3504:3151d67d15d2

[xemacs-hg @ 2006-07-11 23:40:15 by james] Fix a dangerous strcpy by ensuring that the target string is exactly big enough to hold the data. <m3irm9ywg0.fsf@jerrypc.cs.usu.edu>
author james
date Tue, 11 Jul 2006 23:40:17 +0000
parents a54cc1730ca5
children c62ab34c2912
files src/ChangeLog src/sound.c
diffstat 2 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Tue Jul 11 23:36:21 2006 +0000
+++ b/src/ChangeLog	Tue Jul 11 23:40:17 2006 +0000
@@ -1,3 +1,8 @@
+2006-07-07  Jerry James  <james@xemacs.org>
+
+	* sound.c (init_native_sound): Make the target of a strcpy be
+	exactly the right size to hold the copied string.
+
 2006-07-08  Aidan Kehoe  <kehoea@parhasard.net>
 
 	* lisp.h:
--- a/src/sound.c	Tue Jul 11 23:36:21 2006 +0000
+++ b/src/sound.c	Tue Jul 11 23:40:17 2006 +0000
@@ -640,7 +640,7 @@
 		DEVICE_ON_CONSOLE_P (d) = 0;
 	      else
 		{
-		  Extbyte hn [255];
+		  Extbyte *hn = alloca_array (Extbyte, strlen (h->h_name) + 1);
 		  struct hostent *l;
 		  strcpy (hn, h->h_name);
 		  l = gethostbyname (localname);