about summary refs log tree commit diff
path: root/libio/fileops.c
diff options
context:
space:
mode:
authorJoe Simmons-Talbott <josimmon@redhat.com>2023-07-05 21:23:28 +0000
committerJoe Simmons-Talbott <josimmon@redhat.com>2023-07-05 21:24:06 +0000
commit5324d258427fd11ca0f4f595c94016e568b26d6b (patch)
treeccdb786892d04ac4eab6dbd32bb649d5309ee606 /libio/fileops.c
parent02261d1bd930b50e9166086462dca885e9847826 (diff)
downloadglibc-5324d258427fd11ca0f4f595c94016e568b26d6b.tar.gz
glibc-5324d258427fd11ca0f4f595c94016e568b26d6b.tar.xz
glibc-5324d258427fd11ca0f4f595c94016e568b26d6b.zip
fileops: Don't process ,ccs= as individual mode flags (BZ#18906)
In processing the first 7 individual characters of the mode for fopen
if ,ccs= is used those characters will be processed as well.  Stop
processing individual mode flags once a comma is encountered.  This has
the effect of requiring ,ccs= to be the last mode flag in the mode
string.  Add a testcase to check that the ,ccs= mode flag is not
processed as individual mode flags.

Reviewed-by: DJ Delorie <dj@redhat.com>
Diffstat (limited to 'libio/fileops.c')
-rw-r--r--libio/fileops.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/libio/fileops.c b/libio/fileops.c
index 58c9e985e4..1c1113e339 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -247,6 +247,7 @@ _IO_new_file_fopen (FILE *fp, const char *filename, const char *mode,
       switch (*++mode)
 	{
 	case '\0':
+	case ',':
 	  break;
 	case '+':
 	  omode = O_RDWR;