mirror of
https://cagebreak.project-repo.co/cagebreak.git
synced 2026-08-21 13:04:18 +02:00
Add check to prevent buffer overflow
This commit is contained in:
parent
cce8121595
commit
ee71d0bde9
1 changed files with 4 additions and 0 deletions
|
|
@ -807,6 +807,10 @@ print_modes(struct dyn_str *str, char **modes) {
|
|||
++nmemb;
|
||||
++tmp;
|
||||
}
|
||||
if(nmemb==0) {
|
||||
wlr_log(WLR_ERROR,"This is a bug: Cagebreak has no valid modes. This should not occur, since default modes are defined on startup.");
|
||||
return;
|
||||
}
|
||||
/* We are assuming here that we have at least one mode, which is given by
|
||||
* the initialization of cagebreak */
|
||||
char *modes_str = calloc(len + 3 * (nmemb - 1) + 1, sizeof(char));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue