about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-02-09 14:40:06 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-02-09 14:42:55 -0300
commite99156816d5033ca9421c80f55c5c8e7fcd5082b (patch)
tree424eab0997e15bc8d3a75c3fb4c0d193fda606d0 /sysdeps
parent0ff786226c03456bef332950ecf51793205a4f5d (diff)
downloadglibc-e99156816d5033ca9421c80f55c5c8e7fcd5082b.tar.gz
glibc-e99156816d5033ca9421c80f55c5c8e7fcd5082b.tar.xz
glibc-e99156816d5033ca9421c80f55c5c8e7fcd5082b.zip
linux: Fix __sem_check_add_mapping name length
Take in consideration the trailling NULL since sem_search uses
strcmp to compare entries.

Checked on x86_64-linux-gnu and powerpc-linux-gnu (where it triggered
a nptl/tst-sem7 regression).
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/pthread/sem_routines.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sysdeps/pthread/sem_routines.c b/sysdeps/pthread/sem_routines.c
index ea7a445324..c2c8b54cd0 100644
--- a/sysdeps/pthread/sem_routines.c
+++ b/sysdeps/pthread/sem_routines.c
@@ -72,6 +72,7 @@ __sem_check_add_mapping (const char *name, int fd, sem_t *existing)
   size_t namelen = strlen (name);
   if (namelen > NAME_MAX)
     return SEM_FAILED;
+  namelen += 1;
 
   sem_t *result = SEM_FAILED;