From e5e2ca0636f3a065eb88eb85507baa24f5065a46 Mon Sep 17 00:00:00 2001 From: Renaud Fivet Date: Mon, 5 Oct 2015 17:44:05 +0800 Subject: [PATCH] Fix CID114556: Copy into fixed size buffer. --- buffer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/buffer.c b/buffer.c index 9b8a892..ffe1bcb 100644 --- a/buffer.c +++ b/buffer.c @@ -254,7 +254,9 @@ ask: bp = bp->b_bufp ; /* onward */ } - strcpy( curbp->b_bname, bufn) ; /* copy buffer name to structure */ +/* copy buffer name to structure */ + strncpy( curbp->b_bname, bufn, sizeof( bname_t) - 1) ; + curbp->b_bname[ sizeof( bname_t) - 1] = '\0' ; free( bufn) ; curwp->w_flag |= WFMODE ; /* make mode line replot */