Avoid a segfault when txt_max_len becomes too small. Reported by Thorsten, thanks.
This commit is contained in:
parent
df75c2754a
commit
7542f4a711
@ -1,4 +1,4 @@
|
|||||||
/* $calcurse: notify.c,v 1.47 2009/08/17 10:04:39 culot Exp $ */
|
/* $calcurse: notify.c,v 1.48 2010/02/14 17:29:16 culot Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Calcurse - text-based organizer
|
* Calcurse - text-based organizer
|
||||||
@ -268,9 +268,12 @@ notify_update_bar (void)
|
|||||||
{
|
{
|
||||||
if (strlen (notify_app.txt) > txt_max_len)
|
if (strlen (notify_app.txt) > txt_max_len)
|
||||||
{
|
{
|
||||||
|
int shrink_len;
|
||||||
|
|
||||||
too_long = 1;
|
too_long = 1;
|
||||||
(void)strncpy (buf, notify_app.txt, txt_max_len - 3);
|
shrink_len = txt_max_len > 3 ? txt_max_len - 3 : 1;
|
||||||
buf[txt_max_len - 3] = '\0';
|
(void)strncpy (buf, notify_app.txt, shrink_len);
|
||||||
|
buf[shrink_len] = '\0';
|
||||||
}
|
}
|
||||||
time_left = notify_time_left ();
|
time_left = notify_time_left ();
|
||||||
if (time_left > 0)
|
if (time_left > 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user