OSDN Git Service

Use memcpy() instead of strncpy() for copying into varlena structures.
authorPeter Eisentraut <peter_e@gmx.net>
Wed, 7 Feb 2007 00:32:15 +0000 (00:32 +0000)
committerPeter Eisentraut <peter_e@gmx.net>
Wed, 7 Feb 2007 00:32:15 +0000 (00:32 +0000)
contrib/intarray/_int_bool.c
contrib/tsearch2/query.c

index 8517010..23ee8f1 100644 (file)
@@ -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);
 
index b832deb..902ee22 100644 (file)
@@ -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);
        }