- Protect AllocateValue against a null sp.

modified:
  storage/connect/value.cpp
This commit is contained in:
Olivier Bertrand 2015-01-24 12:17:03 +01:00
parent 7ebd3f6fed
commit 5b460c6403

View file

@ -446,7 +446,7 @@ PVAL AllocateValue(PGLOBAL g, PVAL valp, int newtype, int uns)
case TYPE_STRING:
p = (PSZ)PlugSubAlloc(g, NULL, 1 + valp->GetValLen());
if ((sp = valp->GetCharString(p)) != p)
if ((sp = valp->GetCharString(p)) != p && sp)
strcpy(p, sp);
vp = new(g) TYPVAL<PSZ>(g, p, valp->GetValLen(), valp->GetValPrec());
@ -1219,7 +1219,7 @@ TYPVAL<PSZ>::TYPVAL(PSZ s) : VALUE(TYPE_STRING)
TYPVAL<PSZ>::TYPVAL(PGLOBAL g, PSZ s, int n, int c)
: VALUE(TYPE_STRING)
{
Len = (g) ? n : strlen(s);
Len = (g) ? n : (s) ? strlen(s) : 0;
if (!s) {
if (g) {