Package: libao Severity: normal The function _open_default_oss_device is a whole mess. It has some unneeded maybe historical variables and doesn't handle strdup to return NULL. A suggested fix is attached.
-- System Information: Debian Release: testing/unstable APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.9 Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)
diff -ruN libao-0.8.6.old/src/plugins/oss/ao_oss.c
libao-0.8.6/src/plugins/oss/ao_oss.c
--- libao-0.8.6.old/src/plugins/oss/ao_oss.c 2004-11-09 09:20:26.000000000
+0100
+++ libao-0.8.6/src/plugins/oss/ao_oss.c 2005-07-03 12:39:36.023915834
+0200
@@ -78,11 +78,10 @@
int _open_default_oss_device (char **dev_path, int blocking)
{
int fd;
- char *err = NULL;
- char *dev = NULL;
/* default: first try the devfs path */
- *dev_path = strdup("/dev/sound/dsp");
+ if(!(*dev_path = strdup("/dev/sound/dsp")))
+ return -1;
#ifdef BROKEN_OSS
fd = open(*dev_path, O_WRONLY | O_NONBLOCK);
#else
@@ -93,10 +92,9 @@
if(fd < 0)
{
/* no? then try the traditional path */
- err = strdup(strerror(errno));
- dev = strdup(*dev_path);
free(*dev_path);
- *dev_path = strdup("/dev/dsp");
+ if(!(*dev_path = strdup("/dev/dsp")))
+ return -1;
#ifdef BROKEN_OSS
fd = open(*dev_path, O_WRONLY | O_NONBLOCK);
#else
@@ -125,8 +123,6 @@
" %s - %s\n",
err, dev,
strerror(errno), *dev_path); */
- free(err);
- free(dev);
free(*dev_path);
*dev_path = NULL;
}
@@ -185,7 +181,8 @@
if (!strcmp(key, "dsp")) {
/* Free old string in case "dsp" set twice in options */
free(internal->dev);
- internal->dev = strdup(value);
+ if(!(internal->dev = strdup(value)))
+ return 0;
}
return 1;
signature.asc
Description: Digital signature

