-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
free(): invalid pointer crash in path_pwd #694
Comments
I cannot reproduce this. What is your operating system, operating system version, system architecture, etc.? |
I also cannot reproduce this crash. I even went out of my way to replicate a similar environment based on the stacktrace (which looks an awful lot like RHEL 6 or CentOS 6 based on the software versions) and everything works fine for me. The crash for all I know could be caused by something in the kshrc file. |
In any case the stacktrace points to the crash occurring at the free call in Lines 139 to 141 in 00b296c
Lines 210 to 216 in 00b296c
My best guess is that sh.pwd might be used uninitialized here. Below is a patch that sets sh.pwd to NULL in sh_init , which should prevent this scenario (although I'm still not sure this actually fixes the crash, since I can't reproduce it).
--- a/src/cmd/ksh93/sh/init.c
+++ b/src/cmd/ksh93/sh/init.c
@@ -1314,6 +1314,8 @@ Shell_t *sh_init(int argc,char *argv[], Shinit_f userinit)
sh.stk = stkstd;
sfsetbuf(sh.strbuf,NULL,64);
error_info.catalog = e_dict;
+ /* initialize sh.pwd in case it's used uninitialized later */
+ sh.pwd = NULL;
#if SHOPT_REGRESS
{
Opt_t* nopt; |
The whole sh struct is explicitly initialised to zero in defs.c, so sh.pwd is definitely initialised. |
@adavies42, please provide the above information, as well as your .kshrc, so we have a chance of reproducing and tracing the problem. |
yes, this was REHL 6.10 (on intel) i don't have a but i suspect the problem was indeed due to some kind of corruption in pwd on further investigation, i found some very weird stuff going on with the my homedir on this system is on nfs, and i suspect some nfs issue was involved |
93u+m 1.0.6 can crash on startup in
path_pwd
:(exact paths to
ksh
have been redacted)backtrace from the core:
The text was updated successfully, but these errors were encountered: