diff src/userfunc.c @ 28515:c6aadb2c4cd7 v8.2.4782

patch 8.2.4782: accessing freed memory Commit: https://github.com/vim/vim/commit/a929c922b1cb7c84ad1b5d1d0fc9a4f7c68ab8e0 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Apr 18 15:21:17 2022 +0100 patch 8.2.4782: accessing freed memory Problem: Accessing freed memory. Solution: Clear evalarg after checking for trailing characters. (issue #10218)
author Bram Moolenaar <Bram@vim.org>
date Mon, 18 Apr 2022 16:30:03 +0200
parents 769599ee9f06
children 30862b2f7431
line wrap: on
line diff
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -5529,7 +5529,6 @@ ex_call(exarg_T *eap)
     }
     if (eap->skip)
 	--emsg_skip;
-    clear_evalarg(&evalarg, eap);
 
     // When inside :try we need to check for following "| catch" or "| endtry".
     // Not when there was an error, but do check if an exception was thrown.
@@ -5549,6 +5548,8 @@ ex_call(exarg_T *eap)
 	else
 	    set_nextcmd(eap, arg);
     }
+    // Must be after using "arg", it may point into memory cleared here.
+    clear_evalarg(&evalarg, eap);
 
 end:
     dict_unref(fudi.fd_dict);