Commit 5b460c64 authored by Olivier Bertrand's avatar Olivier Bertrand

- Protect AllocateValue against a null sp.

modified:
  storage/connect/value.cpp
parent 7ebd3f6f
...@@ -446,7 +446,7 @@ PVAL AllocateValue(PGLOBAL g, PVAL valp, int newtype, int uns) ...@@ -446,7 +446,7 @@ PVAL AllocateValue(PGLOBAL g, PVAL valp, int newtype, int uns)
case TYPE_STRING: case TYPE_STRING:
p = (PSZ)PlugSubAlloc(g, NULL, 1 + valp->GetValLen()); p = (PSZ)PlugSubAlloc(g, NULL, 1 + valp->GetValLen());
if ((sp = valp->GetCharString(p)) != p) if ((sp = valp->GetCharString(p)) != p && sp)
strcpy(p, sp); strcpy(p, sp);
vp = new(g) TYPVAL<PSZ>(g, p, valp->GetValLen(), valp->GetValPrec()); vp = new(g) TYPVAL<PSZ>(g, p, valp->GetValLen(), valp->GetValPrec());
...@@ -1219,7 +1219,7 @@ TYPVAL<PSZ>::TYPVAL(PSZ s) : VALUE(TYPE_STRING) ...@@ -1219,7 +1219,7 @@ TYPVAL<PSZ>::TYPVAL(PSZ s) : VALUE(TYPE_STRING)
TYPVAL<PSZ>::TYPVAL(PGLOBAL g, PSZ s, int n, int c) TYPVAL<PSZ>::TYPVAL(PGLOBAL g, PSZ s, int n, int c)
: VALUE(TYPE_STRING) : VALUE(TYPE_STRING)
{ {
Len = (g) ? n : strlen(s); Len = (g) ? n : (s) ? strlen(s) : 0;
if (!s) { if (!s) {
if (g) { if (g) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment