Skip to content

Commit 5b460c6

Browse files
committed
- Protect AllocateValue against a null sp.
modified: storage/connect/value.cpp
1 parent 7ebd3f6 commit 5b460c6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

storage/connect/value.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ PVAL AllocateValue(PGLOBAL g, PVAL valp, int newtype, int uns)
446446
case TYPE_STRING:
447447
p = (PSZ)PlugSubAlloc(g, NULL, 1 + valp->GetValLen());
448448

449-
if ((sp = valp->GetCharString(p)) != p)
449+
if ((sp = valp->GetCharString(p)) != p && sp)
450450
strcpy(p, sp);
451451

452452
vp = new(g) TYPVAL<PSZ>(g, p, valp->GetValLen(), valp->GetValPrec());
@@ -1219,7 +1219,7 @@ TYPVAL<PSZ>::TYPVAL(PSZ s) : VALUE(TYPE_STRING)
12191219
TYPVAL<PSZ>::TYPVAL(PGLOBAL g, PSZ s, int n, int c)
12201220
: VALUE(TYPE_STRING)
12211221
{
1222-
Len = (g) ? n : strlen(s);
1222+
Len = (g) ? n : (s) ? strlen(s) : 0;
12231223

12241224
if (!s) {
12251225
if (g) {

0 commit comments

Comments
 (0)