diff options
Diffstat (limited to 'pico/display.c')
-rw-r--r-- | pico/display.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/pico/display.c b/pico/display.c index e8472a06..468de2ce 100644 --- a/pico/display.c +++ b/pico/display.c @@ -1,11 +1,7 @@ -#if !defined(lint) && !defined(DOS) -static char rcsid[] = "$Id: display.c 1025 2008-04-08 22:59:38Z hubert@u.washington.edu $"; -#endif - /* * ======================================================================== * Copyright 2006-2008 University of Washington - * Copyright 2013-2021 Eduardo Chappa + * Copyright 2013-2022 Eduardo Chappa * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -375,7 +371,7 @@ int window_signature_block(WINDOW *wp) { LINE *lp, *llp; - int in_sig, is_sig_start; + int in_sig, is_sig_start = 0; int change = 0; llp = wp->w_linep; @@ -1069,7 +1065,7 @@ updatelinecolor (int row, CELL vline[], CELL pline[], short *flags, int len) * are spaces or not. */ cp3 = &vline[0]; - for(w = 0; w < term.t_ncol; cp3++){ + for(w = 0; w < term.t_ncol && cp3 < &vline[term.t_ncol]; cp3++){ int ww; ww = wcellwidth((UCS) cp3->c); @@ -1393,7 +1389,7 @@ modeline(WINDOW *wp) bp = wp->w_bufp; if(bp->b_fname[0]) /* File name? */ - snprintf(t2, sizeof(t2), "File: %s", bp->b_fname); + snprintf(t2, sizeof(t2), "File: %.*s", (int) sizeof(t2) - 7, bp->b_fname); else{ strncpy(t2, PICO_NEWBUF_MSG, sizeof(t2)); t2[sizeof(t2)-1] = '\0'; @@ -1430,7 +1426,7 @@ modeline(WINDOW *wp) w2_to_3 = term.t_ncol - (ALLBUTSPACE + w1_to_2); else{ if(bp->b_fname[0]){ - snprintf(t2, sizeof(t2), "%s", bp->b_fname); + snprintf(t2, sizeof(t2), "%.*s", (int) sizeof(t2) - 1, bp->b_fname); w2 = utf8_width(t2); } |