Mercurial > vim
comparison src/os_unix.c @ 22695:fa0aac214da6 v8.2.1896
patch 8.2.1896: valgrind warns for using uninitialized memory
Commit: https://github.com/vim/vim/commit/e1be11864d1f4383171e3af3eb77e61d41140c4e
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Oct 24 13:30:51 2020 +0200
patch 8.2.1896: valgrind warns for using uninitialized memory
Problem: Valgrind warns for using uninitialized memory.
Solution: NUL terminate the SmcOpenConnection() error message. (Dominique
Pell?, closes #7194)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 24 Oct 2020 13:45:04 +0200 |
parents | 0f205ff4a0fd |
children | e82579016863 |
comparison
equal
deleted
inserted
replaced
22694:fe872013002c | 22695:fa0aac214da6 |
---|---|
8066 &xsmp.clientid, | 8066 &xsmp.clientid, |
8067 sizeof(errorstring) - 1, | 8067 sizeof(errorstring) - 1, |
8068 errorstring); | 8068 errorstring); |
8069 if (xsmp.smcconn == NULL) | 8069 if (xsmp.smcconn == NULL) |
8070 { | 8070 { |
8071 char errorreport[132]; | |
8072 | |
8073 if (p_verbose > 0) | 8071 if (p_verbose > 0) |
8074 { | 8072 { |
8073 char errorreport[132]; | |
8074 | |
8075 // If the message is too long it might not be NUL terminated. Add | |
8076 // a NUL at the end to make sure we don't go over the end. | |
8077 errorstring[sizeof(errorstring) - 1] = NUL; | |
8075 vim_snprintf(errorreport, sizeof(errorreport), | 8078 vim_snprintf(errorreport, sizeof(errorreport), |
8076 _("XSMP SmcOpenConnection failed: %s"), errorstring); | 8079 _("XSMP SmcOpenConnection failed: %s"), errorstring); |
8077 verb_msg(errorreport); | 8080 verb_msg(errorreport); |
8078 } | 8081 } |
8079 return; | 8082 return; |