esound r509 - trunk
- From: jmouette svn gnome org
- To: svn-commits-list gnome org
- Subject: esound r509 - trunk
- Date: Tue, 18 Nov 2008 20:00:49 +0000 (UTC)
Author: jmouette
Date: Tue Nov 18 20:00:49 2008
New Revision: 509
URL: http://svn.gnome.org/viewvc/esound?rev=509&view=rev
Log:
* esd.c: (esd_connect_unix): prevent strncpy from writing a
non-NULL-terminated string.
* esddsp.c: (dsp_init): same here.
Modified:
trunk/ChangeLog
trunk/esd.c
trunk/esddsp.c
Modified: trunk/esd.c
==============================================================================
--- trunk/esd.c (original)
+++ trunk/esd.c Tue Nov 18 20:00:49 2008
@@ -255,7 +255,8 @@
/* set the connect information */
socket_unix.sun_family = AF_UNIX;
- strncpy(socket_unix.sun_path, ESD_UNIX_SOCKET_NAME, sizeof(socket_unix.sun_path));
+ strncpy(socket_unix.sun_path, ESD_UNIX_SOCKET_NAME, sizeof(socket_unix.sun_path)-1);
+ socket_unix.sun_path[sizeof(socket_unix.sun_path)-1] = '\0';
if ( connect( socket_out,
(struct sockaddr *) &socket_unix, SUN_LEN(&socket_unix) ) < 0 )
return -1;
Modified: trunk/esddsp.c
==============================================================================
--- trunk/esddsp.c (original)
+++ trunk/esddsp.c Tue Nov 18 20:00:49 2008
@@ -132,8 +132,9 @@
const char *str;
str = getenv ("ESDDSP_NAME");
- ident = malloc (ESD_NAME_MAX);
+ ident = malloc (ESD_NAME_MAX+1);
strncpy (ident, (str ? str : "esddsp"), ESD_NAME_MAX);
+ ident[ESD_NAME_MAX] = '\0';
str = getenv("ESDDSP_MMAP");
mmapemu = str && !strcmp(str,"1");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]