From: Lukas Jiriste Date: Tue, 28 May 2024 12:31:03 +0000 (+0200) Subject: Add terminating null to name of philo's semaphore X-Git-Url: https://git.ljiriste.work/?a=commitdiff_plain;h=45e328e3303a3567cef49d7f8589ec1b3f77228f;p=42%2Fphilosophers.git Add terminating null to name of philo's semaphore Otherwise the program may reach memory it should not. --- 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); }