[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Return `ERR` with non-positive `set_tabsize(...)`
From: |
Anthony Sottile |
Subject: |
[PATCH] Return `ERR` with non-positive `set_tabsize(...)` |
Date: |
Fri, 1 Nov 2019 13:55:33 -0700 |
Small demo program:
```c
#include <ncurses.h>
int main() {
initscr();
set_tabsize(0);
mvaddstr(0, 0, "\t*");
getch();
endwin();
}
```
Before this would crash with a "Floating point exception"
Signed-off-by: Anthony Sottile <address@hidden>
---
ncurses/tinfo/lib_setup.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/ncurses/tinfo/lib_setup.c b/ncurses/tinfo/lib_setup.c
index b1d1e1ae..23837e51 100644
--- a/ncurses/tinfo/lib_setup.c
+++ b/ncurses/tinfo/lib_setup.c
@@ -173,6 +173,9 @@ NCURSES_EXPORT(int)
NCURSES_SP_NAME(set_tabsize) (NCURSES_SP_DCLx int value)
{
int code = OK;
+ if (value <= 0) {
+ return ERR;
+ }
#if USE_REENTRANT
if (SP_PARM) {
SP_PARM->_TABSIZE = value;
--
2.17.1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] Return `ERR` with non-positive `set_tabsize(...)`,
Anthony Sottile <=