aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui
diff options
context:
space:
mode:
authorHannes Domani <ssbssa@yahoo.de>2021-01-05 17:10:15 +0100
committerHannes Domani <ssbssa@yahoo.de>2021-02-07 19:11:53 +0100
commit3537bc23d960f961d66d36919049c0cc095c8a9c (patch)
tree0e2f62d8a309b0c0880e6692cc0bf0cfc545ac4d /gdb/tui
parent5fc2d6aa0628864acc4ab2db4a224c580e15df4b (diff)
downloadbinutils-3537bc23d960f961d66d36919049c0cc095c8a9c.zip
binutils-3537bc23d960f961d66d36919049c0cc095c8a9c.tar.gz
binutils-3537bc23d960f961d66d36919049c0cc095c8a9c.tar.bz2
Don't fill regs window with a negative number of spaces
Function n_spaces can't handle negative values, and returns an invalid pointer in this case. gdb/ChangeLog: 2021-02-07 Hannes Domani <ssbssa@yahoo.de> * tui/tui-regs.c (tui_data_item_window::rerender): Don't call n_spaces with a negative value.
Diffstat (limited to 'gdb/tui')
-rw-r--r--gdb/tui/tui-regs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index 78cb209..5caff71 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -492,7 +492,8 @@ tui_data_item_window::rerender (WINDOW *handle, int field_width)
(void) wstandout (handle);
mvwaddnstr (handle, y, x, content.c_str (), field_width - 1);
- waddstr (handle, n_spaces (field_width - content.size ()));
+ if (content.size () < field_width)
+ waddstr (handle, n_spaces (field_width - content.size ()));
if (highlight)
/* We ignore the return value, casting it to void in order to avoid