Mercurial > hg > xemacs-beta
comparison src/sound.c @ 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 | 34cfe24248f6 |
children | 4bcad369dfd4 |
comparison
equal
deleted
inserted
replaced
3503:a54cc1730ca5 | 3504:3151d67d15d2 |
---|---|
638 struct hostent *h = gethostbyname (dpyname); | 638 struct hostent *h = gethostbyname (dpyname); |
639 if (!h) | 639 if (!h) |
640 DEVICE_ON_CONSOLE_P (d) = 0; | 640 DEVICE_ON_CONSOLE_P (d) = 0; |
641 else | 641 else |
642 { | 642 { |
643 Extbyte hn [255]; | 643 Extbyte *hn = alloca_array (Extbyte, strlen (h->h_name) + 1); |
644 struct hostent *l; | 644 struct hostent *l; |
645 strcpy (hn, h->h_name); | 645 strcpy (hn, h->h_name); |
646 l = gethostbyname (localname); | 646 l = gethostbyname (localname); |
647 DEVICE_ON_CONSOLE_P (d) = (l && !(strcmp (l->h_name, hn))); | 647 DEVICE_ON_CONSOLE_P (d) = (l && !(strcmp (l->h_name, hn))); |
648 } | 648 } |