diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2000-07-07 21:12:53 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2000-07-07 21:12:53 +0000 |
commit | 65da0d66b4e89951078ebc43a5343780e4e700d6 (patch) | |
tree | 8bc075c2b755432ac3c51516a0fdbc7dfd0e3c12 /src/backend/port/dynloader/aix.c | |
parent | de85dd1d51ab7325984ef36302831ca21e3ae53e (diff) |
Fix misuse of StrNCpy to copy and add null to non-null-terminated data.
Does not work since it fetches one byte beyond the source data, and when
the phase of the moon is wrong, the source data is smack up against the
end of backend memory and you get SIGSEGV. Don't laugh, this is a fix
for an actual user bug report.
Diffstat (limited to 'src/backend/port/dynloader/aix.c')
-rw-r--r-- | src/backend/port/dynloader/aix.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/port/dynloader/aix.c b/src/backend/port/dynloader/aix.c index 61705551430..c6295406e22 100644 --- a/src/backend/port/dynloader/aix.c +++ b/src/backend/port/dynloader/aix.c @@ -536,7 +536,8 @@ readExports(ModulePtr mp) * first SYMNMLEN chars and make sure we have a zero byte at * the end. */ - StrNCpy(tmpsym, ls->l_name, SYMNMLEN + 1); + strncpy(tmpsym, ls->l_name, SYMNMLEN); + tmpsym[SYMNMLEN] = '\0'; symname = tmpsym; } ep->name = strdup(symname); |