# HG changeset patch # User james # Date 1152661217 0 # Node ID 3151d67d15d238a53f201ea3caab859b010952ed # Parent a54cc1730ca55cbf8ccd0904ff8fb944374c3931 [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. diff -r a54cc1730ca5 -r 3151d67d15d2 src/ChangeLog --- 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 + + * 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 * lisp.h: diff -r a54cc1730ca5 -r 3151d67d15d2 src/sound.c --- 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);