Skip to content
Snippets Groups Projects
Commit f11aa82d authored by Peter Eisentraut's avatar Peter Eisentraut
Browse files

Use memcpy() instead of strncpy() for copying into varlena structures.

parent 4f64a07b
Branches
Tags
No related merge requests found
......@@ -779,7 +779,7 @@ querytree(PG_FUNCTION_ARGS)
res = (text *) palloc(nrm.cur - nrm.buf + VARHDRSZ);
VARATT_SIZEP(res) = nrm.cur - nrm.buf + VARHDRSZ;
strncpy(VARDATA(res), nrm.buf, nrm.cur - nrm.buf);
memcpy(VARDATA(res), nrm.buf, nrm.cur - nrm.buf);
}
pfree(q);
......
......
......@@ -928,7 +928,7 @@ tsquerytree(PG_FUNCTION_ARGS)
res = (text *) palloc(nrm.cur - nrm.buf + VARHDRSZ);
VARATT_SIZEP(res) = nrm.cur - nrm.buf + VARHDRSZ;
strncpy(VARDATA(res), nrm.buf, nrm.cur - nrm.buf);
memcpy(VARDATA(res), nrm.buf, nrm.cur - nrm.buf);
pfree(q);
}
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment