File bash-4.2-boo976776.dif of Package bash.openSUSE_Leap_42.1_Update
Avoid crash on empty ~/.bash_history in case su is used (boo#976776)
---
lib/readline/history.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- lib/readline/history.c
+++ lib/readline/history.c 2016-04-26 09:29:22.197488997 +0000
@@ -318,7 +318,7 @@ add_history_time (string)
{
HIST_ENTRY *hs;
- if (string == 0)
+ if (string == 0 || history_length < 0)
return;
hs = the_history[history_length - 1];
FREE (hs->timestamp);