From adc2fb8a6a8d98f32eea2d1022f14cadfdf915e3 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Sat, 23 May 2015 14:13:41 -0700 Subject: [PATCH] Issue #24268: Fix import naming when loading extension modules. Patch by Petr Viktorin. --- Python/dynload_dl.c | 2 +- Python/dynload_hpux.c | 4 ++-- Python/dynload_next.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Python/dynload_dl.c b/Python/dynload_dl.c index d235a84c15c..2bec645fbd7 100644 --- a/Python/dynload_dl.c +++ b/Python/dynload_dl.c @@ -18,6 +18,6 @@ dl_funcptr _PyImport_FindSharedFuncptr(const char *prefix, { char funcname[258]; - PyOS_snprintf(funcname, sizeof(funcname), "%20s_%.200s", prefix, shortname); + PyOS_snprintf(funcname, sizeof(funcname), "%.20s_%.200s", prefix, shortname); return dl_loadmod(Py_GetProgramName(), pathname, funcname); } diff --git a/Python/dynload_hpux.c b/Python/dynload_hpux.c index e28ae7c903e..4967afc39c1 100644 --- a/Python/dynload_hpux.c +++ b/Python/dynload_hpux.c @@ -8,9 +8,9 @@ #include "importdl.h" #if defined(__hp9000s300) -#define FUNCNAME_PATTERN "_%20s_%.200s" +#define FUNCNAME_PATTERN "_%.20s_%.200s" #else -#define FUNCNAME_PATTERN "%20s_%.200s" +#define FUNCNAME_PATTERN "%.20s_%.200s" #endif const char *_PyImport_DynLoadFiletab[] = {SHLIB_EXT, NULL}; diff --git a/Python/dynload_next.c b/Python/dynload_next.c index c555b3802f7..83a8b2bb319 100644 --- a/Python/dynload_next.c +++ b/Python/dynload_next.c @@ -40,7 +40,7 @@ dl_funcptr _PyImport_FindSharedFuncptr(const char *prefix, const char *errString; char errBuf[512]; - PyOS_snprintf(funcname, sizeof(funcname), "_%20s_%.200s", prefix, shortname); + PyOS_snprintf(funcname, sizeof(funcname), "_%.20s_%.200s", prefix, shortname); #ifdef USE_DYLD_GLOBAL_NAMESPACE if (NSIsSymbolNameDefined(funcname)) {