linux: Fix __sem_check_add_mapping name length
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 9 Feb 2021 17:40:06 +0000 (14:40 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 9 Feb 2021 17:42:55 +0000 (14:42 -0300)
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).

sysdeps/pthread/sem_routines.c

index ea7a44532404aaba9ad4de11fc1dbf1a99015e8d..c2c8b54cd0fcdcb16d40e76619dc46717dd231a4 100644 (file)
@@ -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;