diff --git a/contrib/hstore/hstore_io.c b/contrib/hstore/hstore_io.c index 93206193916..cf6fd7c6aa5 100644 --- a/contrib/hstore/hstore_io.c +++ b/contrib/hstore/hstore_io.c @@ -339,7 +339,8 @@ hstoreUniquePairs(Pairs *a, int32 l, int32 *buflen) { *buflen += res->keylen + ((res->isnull) ? 0 : res->vallen); res++; - memcpy(res, ptr, sizeof(Pairs)); + if (res != ptr) + memcpy(res, ptr, sizeof(Pairs)); } ptr++;