len = strnlen((const char *)buf, bufsize) + 1;
if (bufsize < len)
goto no_space;
- *ps = SMB_STRDUP((const char *)buf);
- if (*ps == NULL) {
- goto no_space;
+ if (ps != NULL) {
+ *ps = SMB_STRDUP((const char *)buf);
+ if (*ps == NULL) {
+ goto no_space;
+ }
}
break;
case 'f': /* null-terminated string */
len = strnlen((const char *)buf, bufsize) + 1;
if (bufsize < len || len > sizeof(fstring))
goto no_space;
- memcpy(s, buf, len);
+ if (s != NULL) {
+ memcpy(s, buf, len);
+ }
break;
case 'B': /* fixed-length string */
i = va_arg(ap, uint32_t *);
}
if (bufsize < len)
goto no_space;
- *b = (char *)SMB_MALLOC(*i);
- if (! *b)
- goto no_space;
- memcpy(*b, buf+4, *i);
+ if (b != NULL) {
+ *b = (char *)SMB_MALLOC(*i);
+ if (! *b)
+ goto no_space;
+ memcpy(*b, buf+4, *i);
+ }
break;
default:
DEBUG(0,("Unknown tdb_unpack format %c in %s\n",