X-Git-Url: https://ncurses.scripts.mit.edu/?a=blobdiff_plain;f=ncurses%2Fbase%2Flib_insnstr.c;h=dd51a9cd18f9ab41436d57c3b8aa7a33230e7128;hb=a0914678507b8ee1d1a0440625235fd7b48964bc;hp=8ee26a8091c1ef5d20140d457ed42571072fb920;hpb=b86393354bb86154b7b860989e5ed8655611d30b;p=ncurses.git diff --git a/ncurses/base/lib_insnstr.c b/ncurses/base/lib_insnstr.c index 8ee26a80..dd51a9cd 100644 --- a/ncurses/base/lib_insnstr.c +++ b/ncurses/base/lib_insnstr.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 2004-2016,2018 Free Software Foundation, Inc. * + * Copyright 2018-2020,2022 Thomas E. Dickey * + * Copyright 2004-2009,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -40,7 +41,7 @@ #include #include -MODULE_ID("$Id: lib_insnstr.c,v 1.6 2018/03/10 20:13:59 Gyorgy.Jeney Exp $") +MODULE_ID("$Id: lib_insnstr.c,v 1.8 2022/05/21 17:35:15 tom Exp $") NCURSES_EXPORT(int) winsnstr(WINDOW *win, const char *s, int n) @@ -69,6 +70,7 @@ winsnstr(WINDOW *win, const char *s, int n) init_mb(state); n3 = mbstowcs(buffer, s, nn); if (n3 != (size_t) (-1)) { + buffer[n3] = '\0'; code = wins_nwstr(win, buffer, (int) n3); } free(buffer);