mirror of
https://github.com/vale981/spectrwm
synced 2025-03-05 09:51:38 -05:00
Fix OOB while reading bar input.
If the status bar script returns NUL as the first character through stdin, spectrwm is prone to an out of boundary access. Depending on the memory layout of the machine, it could turn into an OOB write. The fix is simple: If the string is empty, do not further check for newline character. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
This commit is contained in:
parent
1ec03c62be
commit
ea3e6da622
1 changed files with 1 additions and 1 deletions
|
@ -2761,7 +2761,7 @@ bar_extra_update(void)
|
|||
while (fgets(b, sizeof(b), stdin) != NULL) {
|
||||
if (bar_enabled) {
|
||||
len = strlen(b);
|
||||
if (b[len - 1] == '\n') {
|
||||
if (len > 0 && b[len - 1] == '\n') {
|
||||
/* Remove newline. */
|
||||
b[--len] = '\0';
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue