Skip to content

Commit f11aa82

Browse files
committed
Use memcpy() instead of strncpy() for copying into varlena structures.
1 parent 4f64a07 commit f11aa82

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

contrib/intarray/_int_bool.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ querytree(PG_FUNCTION_ARGS)
779779

780780
res = (text *) palloc(nrm.cur - nrm.buf + VARHDRSZ);
781781
VARATT_SIZEP(res) = nrm.cur - nrm.buf + VARHDRSZ;
782-
strncpy(VARDATA(res), nrm.buf, nrm.cur - nrm.buf);
782+
memcpy(VARDATA(res), nrm.buf, nrm.cur - nrm.buf);
783783
}
784784
pfree(q);
785785

contrib/tsearch2/query.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ tsquerytree(PG_FUNCTION_ARGS)
928928

929929
res = (text *) palloc(nrm.cur - nrm.buf + VARHDRSZ);
930930
VARATT_SIZEP(res) = nrm.cur - nrm.buf + VARHDRSZ;
931-
strncpy(VARDATA(res), nrm.buf, nrm.cur - nrm.buf);
931+
memcpy(VARDATA(res), nrm.buf, nrm.cur - nrm.buf);
932932
pfree(q);
933933
}
934934

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy