[pulseaudio-commits] r2106 - /trunk/src/utils/padsp.c
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Fri Feb 15 03:50:49 PST 2008
Author: lennart
Date: Fri Feb 15 12:50:48 2008
New Revision: 2106
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=2106&root=pulseaudio&view=rev
Log:
Improve compatibility with applications which like to pass invalid strings to the libc functions we overwrite, by handing directly to the original function. Patch by Colin Guthrie and Gustavo De Nardin, Closes #227
Modified:
trunk/src/utils/padsp.c
Modified: trunk/src/utils/padsp.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/utils/padsp.c?rev=2106&root=pulseaudio&r1=2105&r2=2106&view=diff
==============================================================================
--- trunk/src/utils/padsp.c (original)
+++ trunk/src/utils/padsp.c Fri Feb 15 12:50:48 2008
@@ -1443,18 +1443,18 @@
static int real_open(const char *filename, int flags, mode_t mode) {
int r, _errno = 0;
- debug(DEBUG_LEVEL_VERBOSE, __FILE__": open(%s)\n", filename);
+ debug(DEBUG_LEVEL_VERBOSE, __FILE__": open(%s)\n", filename?filename:"NULL");
if (!function_enter()) {
LOAD_OPEN_FUNC();
return _open(filename, flags, mode);
}
- if (dsp_cloak_enable() && (strcmp(filename, "/dev/dsp") == 0 || strcmp(filename, "/dev/adsp") == 0))
+ if (filename && dsp_cloak_enable() && (strcmp(filename, "/dev/dsp") == 0 || strcmp(filename, "/dev/adsp") == 0))
r = dsp_open(flags, &_errno);
- else if (mixer_cloak_enable() && strcmp(filename, "/dev/mixer") == 0)
+ else if (filename && mixer_cloak_enable() && strcmp(filename, "/dev/mixer") == 0)
r = mixer_open(flags, &_errno);
- else if (sndstat_cloak_enable() && strcmp(filename, "/dev/sndstat") == 0)
+ else if (filename && sndstat_cloak_enable() && strcmp(filename, "/dev/sndstat") == 0)
r = sndstat_open(flags, &_errno);
else {
function_exit();
@@ -2371,18 +2371,13 @@
int access(const char *pathname, int mode) {
- if (!pathname) {
- /* Firefox needs this. See #27 */
- errno = EFAULT;
- return -1;
- }
-
- debug(DEBUG_LEVEL_VERBOSE, __FILE__": access(%s)\n", pathname);
-
- if (strcmp(pathname, "/dev/dsp") != 0 &&
- strcmp(pathname, "/dev/adsp") != 0 &&
- strcmp(pathname, "/dev/sndstat") != 0 &&
- strcmp(pathname, "/dev/mixer") != 0) {
+ debug(DEBUG_LEVEL_VERBOSE, __FILE__": access(%s)\n", pathname?pathname:"NULL");
+
+ if (!pathname ||
+ ( strcmp(pathname, "/dev/dsp") != 0 &&
+ strcmp(pathname, "/dev/adsp") != 0 &&
+ strcmp(pathname, "/dev/sndstat") != 0 &&
+ strcmp(pathname, "/dev/mixer") != 0 )) {
LOAD_ACCESS_FUNC();
return _access(pathname, mode);
}
@@ -2406,16 +2401,13 @@
#endif
int ret;
- if (!pathname || !buf) {
- errno = EFAULT;
- return -1;
- }
-
- if (strcmp(pathname, "/dev/dsp") != 0 &&
- strcmp(pathname, "/dev/adsp") != 0 &&
- strcmp(pathname, "/dev/sndstat") != 0 &&
- strcmp(pathname, "/dev/mixer") != 0) {
- debug(DEBUG_LEVEL_VERBOSE, __FILE__": stat(%s)\n", pathname);
+ if (!pathname ||
+ !buf ||
+ ( strcmp(pathname, "/dev/dsp") != 0 &&
+ strcmp(pathname, "/dev/adsp") != 0 &&
+ strcmp(pathname, "/dev/sndstat") != 0 &&
+ strcmp(pathname, "/dev/mixer") != 0 )) {
+ debug(DEBUG_LEVEL_VERBOSE, __FILE__": stat(%s)\n", pathname?pathname:"NULL");
LOAD_STAT_FUNC();
return _stat(pathname, buf);
}
@@ -2464,17 +2456,14 @@
struct stat oldbuf;
int ret;
- if (!pathname || !buf) {
- errno = EFAULT;
- return -1;
- }
-
- debug(DEBUG_LEVEL_VERBOSE, __FILE__": stat64(%s)\n", pathname);
-
- if (strcmp(pathname, "/dev/dsp") != 0 &&
- strcmp(pathname, "/dev/adsp") != 0 &&
- strcmp(pathname, "/dev/sndstat") != 0 &&
- strcmp(pathname, "/dev/mixer") != 0) {
+ debug(DEBUG_LEVEL_VERBOSE, __FILE__": stat64(%s)\n", pathname?pathname:"NULL");
+
+ if (!pathname ||
+ !buf ||
+ ( strcmp(pathname, "/dev/dsp") != 0 &&
+ strcmp(pathname, "/dev/adsp") != 0 &&
+ strcmp(pathname, "/dev/sndstat") != 0 &&
+ strcmp(pathname, "/dev/mixer") != 0 )) {
LOAD_STAT64_FUNC();
return _stat64(pathname, buf);
}
@@ -2504,7 +2493,7 @@
va_list args;
mode_t mode = 0;
- debug(DEBUG_LEVEL_VERBOSE, __FILE__": open64(%s)\n", filename);
+ debug(DEBUG_LEVEL_VERBOSE, __FILE__": open64(%s)\n", filename?filename:"NULL");
if (flags & O_CREAT) {
va_start(args, flags);
@@ -2515,10 +2504,11 @@
va_end(args);
}
- if (strcmp(filename, "/dev/dsp") != 0 &&
- strcmp(filename, "/dev/adsp") != 0 &&
- strcmp(filename, "/dev/sndstat") != 0 &&
- strcmp(filename, "/dev/mixer") != 0) {
+ if (!filename ||
+ ( strcmp(filename, "/dev/dsp") != 0 &&
+ strcmp(filename, "/dev/adsp") != 0 &&
+ strcmp(filename, "/dev/sndstat") != 0 &&
+ strcmp(filename, "/dev/mixer") != 0 )) {
LOAD_OPEN64_FUNC();
return _open64(filename, flags, mode);
}
@@ -2531,17 +2521,14 @@
#ifdef _STAT_VER
int __xstat(int ver, const char *pathname, struct stat *buf) {
- if (!pathname || !buf) {
- errno = EFAULT;
- return -1;
- }
-
- debug(DEBUG_LEVEL_VERBOSE, __FILE__": __xstat(%s)\n", pathname);
-
- if (strcmp(pathname, "/dev/dsp") != 0 &&
- strcmp(pathname, "/dev/adsp") != 0 &&
- strcmp(pathname, "/dev/sndstat") != 0 &&
- strcmp(pathname, "/dev/mixer") != 0) {
+ debug(DEBUG_LEVEL_VERBOSE, __FILE__": __xstat(%s)\n", pathname?pathname:"NULL");
+
+ if (!pathname ||
+ !buf ||
+ ( strcmp(pathname, "/dev/dsp") != 0 &&
+ strcmp(pathname, "/dev/adsp") != 0 &&
+ strcmp(pathname, "/dev/sndstat") != 0 &&
+ strcmp(pathname, "/dev/mixer") != 0 )) {
LOAD_XSTAT_FUNC();
return ___xstat(ver, pathname, buf);
}
@@ -2557,17 +2544,14 @@
#ifdef HAVE_OPEN64
int __xstat64(int ver, const char *pathname, struct stat64 *buf) {
- if (!pathname || !buf) {
- errno = EFAULT;
- return -1;
- }
-
- debug(DEBUG_LEVEL_VERBOSE, __FILE__": __xstat64(%s)\n", pathname);
-
- if (strcmp(pathname, "/dev/dsp") != 0 &&
- strcmp(pathname, "/dev/adsp") != 0 &&
- strcmp(pathname, "/dev/sndstat") != 0 &&
- strcmp(pathname, "/dev/mixer") != 0) {
+ debug(DEBUG_LEVEL_VERBOSE, __FILE__": __xstat64(%s)\n", pathname?pathname:"NULL");
+
+ if (!pathname ||
+ !buf ||
+ ( strcmp(pathname, "/dev/dsp") != 0 &&
+ strcmp(pathname, "/dev/adsp") != 0 &&
+ strcmp(pathname, "/dev/sndstat") != 0 &&
+ strcmp(pathname, "/dev/mixer") != 0 )) {
LOAD_XSTAT64_FUNC();
return ___xstat64(ver, pathname, buf);
}
@@ -2589,12 +2573,14 @@
int fd;
mode_t m;
- debug(DEBUG_LEVEL_VERBOSE, __FILE__": fopen(%s)\n", filename);
-
- if (strcmp(filename, "/dev/dsp") != 0 &&
- strcmp(filename, "/dev/adsp") != 0 &&
- strcmp(filename, "/dev/sndstat") != 0 &&
- strcmp(filename, "/dev/mixer") != 0) {
+ debug(DEBUG_LEVEL_VERBOSE, __FILE__": fopen(%s)\n", filename?filename:"NULL");
+
+ if (!filename ||
+ !mode ||
+ ( strcmp(filename, "/dev/dsp") != 0 &&
+ strcmp(filename, "/dev/adsp") != 0 &&
+ strcmp(filename, "/dev/sndstat") != 0 &&
+ strcmp(filename, "/dev/mixer") != 0 )) {
LOAD_FOPEN_FUNC();
return _fopen(filename, mode);
}
@@ -2630,12 +2616,14 @@
FILE *fopen64(const char *filename, const char *mode) {
- debug(DEBUG_LEVEL_VERBOSE, __FILE__": fopen64(%s)\n", filename);
-
- if (strcmp(filename, "/dev/dsp") != 0 &&
- strcmp(filename, "/dev/adsp") != 0 &&
- strcmp(filename, "/dev/sndstat") != 0 &&
- strcmp(filename, "/dev/mixer") != 0) {
+ debug(DEBUG_LEVEL_VERBOSE, __FILE__": fopen64(%s)\n", filename?filename:"NULL");
+
+ if (!filename ||
+ !mode ||
+ ( strcmp(filename, "/dev/dsp") != 0 &&
+ strcmp(filename, "/dev/adsp") != 0 &&
+ strcmp(filename, "/dev/sndstat") != 0 &&
+ strcmp(filename, "/dev/mixer") != 0 )) {
LOAD_FOPEN64_FUNC();
return _fopen64(filename, mode);
}
More information about the pulseaudio-commits
mailing list