neatvi icon indicating copy to clipboard operation
neatvi copied to clipboard

fix ex.c:767 snprintf missing format parameter

Open qianqiangliu opened this issue 6 years ago • 1 comments

qianqiangliu avatar Dec 21 '18 00:12 qianqiangliu

mattn @.***> wrote:

@mattn commented on this pull request.

@@ -764,7 +764,7 @@ static int ec_ft(char *ec) char arg[EXLEN]; ex_arg(ec, arg); if (arg[0])

  • snprintf(bufs[0].ft, sizeof(bufs[0].ft), arg);
    
  • snprintf(bufs[0].ft, sizeof(bufs[0].ft), "%s", arg);
    

This has been already applied (commit 64692972).

Simply:

strncpy(bufs[0].ft, arg, sizeof(bufs[0].ft)-1);

Though it may not be necessary here, some care is necessary regarding the NUL byte when using strncpy.

Thanks, Ali

aligrudi avatar Oct 03 '21 18:10 aligrudi