Mercurial > vim
view src/Make_ming.mak @ 34627:5071d4c3ff2e v9.1.0202
patch 9.1.0202: leaking memory in add_user() on failure
Commit: https://github.com/vim/vim/commit/7a2f217988afa1c35b9c093a9d3477198ea250b9
Author: Christian Brabandt <cb@256bit.org>
Date: Sun Mar 24 09:50:03 2024 +0100
patch 9.1.0202: leaking memory in add_user() on failure
Problem: leaking memory in add_user() (LuMingYinDetect)
Solution: free user_copy pointer instead of the user ptr
add_user() is called with a user pointer and the user pointer comes
from these functions:
- return value from the getpwent() function (Unix).
- return value from the getpwnam() function (Unix).
- return value from the NetUserEnum() function (MS Windows).
For the first 2 callers, the man page for those functions directly says,
one should not free the returned pointer (since it comes from static
memory).
For the third caller (on MS Windows), the returned buffer is already
freed directly after calling the add_user() function in
NetApiBufferFree(), so this would lead to a double free().
This all indicates, the user ptr is wrongly freed in the add_user()
function and the intention was to free the user_copy pointer instead in
case of an error.
So let's just use that now.
fixes: #14250
closes: #14260
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 24 Mar 2024 10:00:09 +0100 |
parents | 626fb8e8bb8a |
children |
line wrap: on
line source
# # Makefile for VIM on Win32, using MinGW # # Also read INSTALLpc.txt! # # The old Make_ming.mak (maintained by Ron Aaron et al.) was merged into # Make_cyg_ming.mak. # This file contains MinGW specific settings. Common settings are contained # in Make_cyg_ming.mak. # # Last updated by Ken Takata. # Last Change: 2014 Oct 21 # uncomment 'PERL' if you want a perl-enabled version #PERL=c:/perl # uncomment 'LUA' if you want a Lua-enabled version #LUA=c:/lua # uncomment 'MZSCHEME' if you want a MzScheme-enabled version #MZSCHEME=d:/plt # uncomment 'PYTHON' if you want a python-enabled version # Put the path to the python distro here. If cross compiling from Linux, you # will also need to convert the header files to unix instead of dos format: # for fil in *.h ; do vim -e -c 'set ff=unix|w|q' $fil # and also, you will need to make a mingw32 'libpython20.a' to link with: # cd $PYTHON/libs # pexports python20.dll > python20.def # dlltool -d python20.def -l libpython20.a # on my Linux box, I put the Python stuff here: #PYTHON=/home/ron/ActivePython-2.0.0-202/src/Core # on my NT box, it's here: #PYTHON=c:/python20 # uncomment 'PYTHON3' if you want a python3-enabled version #PYTHON3=c:/python31 # uncomment 'TCL' if you want a Tcl-enabled version #TCL=c:/tcl # uncomment 'RUBY' if you want a Ruby-enabled version #RUBY=c:/ruby # Do not change this. UNDER_CYGWIN = no include Make_cyg_ming.mak # vim: set noet sw=8 ts=8 sts=0 wm=0 tw=0: