diff options
author | Jim Meyering <meyering@redhat.com> | 2012-05-02 18:12:13 +0800 |
---|---|---|
committer | Chong Yidong <cyd@gnu.org> | 2012-05-02 18:12:13 +0800 |
commit | bf98199cf1bea244378538d60838f81cb3a34b49 (patch) | |
tree | ee8ffe8445eb073346878b4eb2731264c97c599e /src/w32font.c | |
parent | cd3771a08b8a1fed5aa91eb2ac559d41801668ea (diff) | |
download | emacs-bf98199cf1bea244378538d60838f81cb3a34b49.tar.gz |
Add NUL-termination to some uses of strncpy.
* lib-src/pop.c (pop_stat, pop_list, pop_multi_first, pop_last):
NUL-terminate the error buffer.
* src/w32font.c (fill_in_logfont): NUL-terminate a string (Bug#11372).
Diffstat (limited to 'src/w32font.c')
-rw-r--r-- | src/w32font.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/w32font.c b/src/w32font.c index dab9f4c61b4..8badace9635 100644 --- a/src/w32font.c +++ b/src/w32font.c @@ -2045,8 +2045,11 @@ fill_in_logfont (FRAME_PTR f, LOGFONT *logfont, Lisp_Object font_spec) /* Font families are interned, but allow for strings also in case of user input. */ else if (SYMBOLP (tmp)) - strncpy (logfont->lfFaceName, - SDATA (ENCODE_SYSTEM (SYMBOL_NAME (tmp))), LF_FACESIZE); + { + strncpy (logfont->lfFaceName, + SDATA (ENCODE_SYSTEM (SYMBOL_NAME (tmp))), LF_FACESIZE); + logfont->lfFaceName[LF_FACESIZE-1] = '\0'; + } } tmp = AREF (font_spec, FONT_ADSTYLE_INDEX); |