1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-24 00:45:52 +00:00

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
This commit is contained in:
Joe Marcus Clarke 2007-03-22 23:51:46 +00:00
parent 3cdb19f952
commit 3564f183cb
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=188064
2 changed files with 36 additions and 4 deletions

View File

@ -7,7 +7,7 @@
PORTNAME= esound
PORTVERSION= 0.2.37
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= audio
MASTER_SITES= ${MASTER_SITE_GNOME}
MASTER_SITE_SUBDIR= sources/${PORTNAME}/0.2

View File

@ -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);
}