projects
/
42
/
philosophers.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5e460a2
)
Add terminating null to name of philo's semaphore
author
Lukas Jiriste
<ljiriste@student.42prague.com>
Tue, 28 May 2024 12:31:03 +0000
(14:31 +0200)
committer
Lukas Jiriste
<ljiriste@student.42prague.com>
Tue, 28 May 2024 12:31:03 +0000
(14:31 +0200)
Otherwise the program may reach memory it should not.
philo_bonus/helpers.c
patch
|
blob
|
history
diff --git
a/philo_bonus/helpers.c
b/philo_bonus/helpers.c
index f8caa764e640f1286462886ca4139cc61922a789..c7e54b0cb5f172c305bb485bd75ef7b3f6e9d94e 100644
(file)
--- 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);
}