summaryrefslogtreecommitdiffstats
path: root/unix/tclLoadDyld.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-07-27 15:13:36 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-07-27 15:13:36 (GMT)
commit8225b1fd250bbd3d71a52ca514ae343a91dfcdc5 (patch)
treea91dde691bf66a3e79e57ac8058f0ab98348bc68 /unix/tclLoadDyld.c
parentaf64c95042a9706c6d45118c8f341aafa5c26686 (diff)
parent192dc7dffdb4bd9d434e1f54830711df4fed4672 (diff)
downloadtcl-8225b1fd250bbd3d71a52ca514ae343a91dfcdc5.zip
tcl-8225b1fd250bbd3d71a52ca514ae343a91dfcdc5.tar.gz
tcl-8225b1fd250bbd3d71a52ca514ae343a91dfcdc5.tar.bz2
Rebase to 9.0. Add more filname encoding checks
Diffstat (limited to 'unix/tclLoadDyld.c')
-rw-r--r--unix/tclLoadDyld.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/unix/tclLoadDyld.c b/unix/tclLoadDyld.c
index cc3512d..67e1682 100644
--- a/unix/tclLoadDyld.c
+++ b/unix/tclLoadDyld.c
@@ -184,8 +184,12 @@ TclpDlopen(
*/
nativePath = (const char *)Tcl_FSGetNativePath(pathPtr);
- nativeFileName = Tcl_UtfToExternalDString(NULL, TclGetString(pathPtr),
- TCL_INDEX_NONE, &ds);
+ if (Tcl_UtfToExternalDStringEx(interp, NULL, TclGetString(pathPtr),
+ TCL_INDEX_NONE, 0, &ds, NULL) != TCL_OK) {
+ Tcl_DStringFree(&ds);
+ return TCL_ERROR;
+ }
+ nativeFileName = Tcl_DStringValue(&ds);
#if TCL_DYLD_USE_DLFCN
/*
@@ -341,7 +345,11 @@ FindSymbol(
Tcl_DString ds;
const char *native;
- native = Tcl_UtfToExternalDString(NULL, symbol, TCL_INDEX_NONE, &ds);
+ if (Tcl_UtfToExternalDStringEx(interp, NULL, symbol, TCL_INDEX_NONE, 0, &ds, NULL) != TCL_OK) {
+ Tcl_DStringFree(&ds);
+ return NULL;
+ }
+ native = Tcl_DStringValue(&ds);
if (dyldLoadHandle->dlHandle) {
#if TCL_DYLD_USE_DLFCN
proc = (Tcl_LibraryInitProc *)dlsym(dyldLoadHandle->dlHandle, native);