diff options
author | Joe Marcus Clarke <marcus@FreeBSD.org> | 2007-03-22 23:51:46 +0000 |
---|---|---|
committer | Joe Marcus Clarke <marcus@FreeBSD.org> | 2007-03-22 23:51:46 +0000 |
commit | 3564f183cb7c5c3a1f0b3d0c2006469cf7c11325 (patch) | |
tree | 31ccd5888cfe22b1bad3837ce08e0281d349289b /audio/esound/files | |
parent | - Make gettext optional with WITHOUT_NLS knob (diff) |
Protect the check for the mode argument to open with a test to make
sure flags contains O_CREAT. This fixes a potential bus error.
PR: 110673
Diffstat (limited to 'audio/esound/files')
-rw-r--r-- | audio/esound/files/patch-esddsp.c | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/audio/esound/files/patch-esddsp.c b/audio/esound/files/patch-esddsp.c index c1175da944ab..6751ca4abbb9 100644 --- a/audio/esound/files/patch-esddsp.c +++ b/audio/esound/files/patch-esddsp.c @@ -1,6 +1,6 @@ ---- esddsp.c.orig Tue Apr 26 22:41:23 2005 -+++ esddsp.c Tue Apr 26 22:42:04 2005 -@@ -223,9 +223,12 @@ open (const char *pathname, int flags, . +--- esddsp.c.orig Mon Jan 1 18:56:06 2007 ++++ esddsp.c Thu Mar 22 19:49:15 2007 +@@ -224,9 +224,12 @@ open_wrapper (int (*func) (const char *, dsp_init (); @@ -16,3 +16,35 @@ if (!strcmp (pathname, "/dev/dsp")) { +@@ -272,9 +275,12 @@ open (const char *pathname, int flags, . + } + } + +- va_start (args, flags); +- mode = va_arg (args, mode_t); +- va_end (args); ++ if ((flags & O_CREAT) != 0) ++ { ++ va_start (args, flags); ++ mode = va_arg (args, mode_t); ++ va_end (args); ++ } + + return open_wrapper(func, pathname, flags, mode); + } +@@ -299,9 +305,12 @@ open64 (const char *pathname, int flags, + } + } + +- va_start (args, flags); +- mode = va_arg (args, mode_t); +- va_end (args); ++ if ((flags & O_CREAT) != 0) ++ { ++ va_start (args, flags); ++ mode = va_arg (args, mode_t); ++ va_end (args); ++ } + + return open_wrapper(func, pathname, flags, mode); + } |