We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8a24179 commit 82c117cCopy full SHA for 82c117c
src/backend/utils/mmgr/mcxt.c
@@ -21,6 +21,7 @@
21
22
#include "postgres.h"
23
24
+#include "common/string.h"
25
#include "miscadmin.h"
26
#include "utils/memdebug.h"
27
#include "utils/memutils.h"
@@ -1086,10 +1087,14 @@ pstrdup(const char *in)
1086
1087
char *
1088
pnstrdup(const char *in, Size len)
1089
{
- char *out = palloc(len + 1);
1090
+ char *out;
1091
1092
+ len = pg_strnlen(in, len);
1093
+
1094
+ out = palloc(len + 1);
1095
memcpy(out, in, len);
1096
out[len] = '\0';
1097
1098
return out;
1099
}
1100
0 commit comments