From 45e328e3303a3567cef49d7f8589ec1b3f77228f Mon Sep 17 00:00:00 2001 From: Lukas Jiriste Date: Tue, 28 May 2024 14:31:03 +0200 Subject: [PATCH] Add terminating null to name of philo's semaphore Otherwise the program may reach memory it should not. --- philo_bonus/helpers.c | 1 + 1 file changed, 1 insertion(+) diff --git a/philo_bonus/helpers.c b/philo_bonus/helpers.c index f8caa76..c7e54b0 100644 --- a/philo_bonus/helpers.c +++ b/philo_bonus/helpers.c @@ -77,6 +77,7 @@ char *create_philo_sem_name(unsigned int id) name[i + j] = id_str[j]; ++j; } + name[i + j] = '\0'; free(id_str); return (name); } -- 2.30.2