#endif /* HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS */
#define strlcpy_base(dest, src, base, size) \
- strlcpy(dest, src, size-PTR_DIFF(dest,base))
+ strlcpy((dest), (src) ? (src) : "", (size)-PTR_DIFF((dest),(base)))
/* String copy functions - macro hell below adds 'type checking' (limited,
but the best we can do in C) */
tmpbuf = strupper_talloc(mem_ctx, passwd);
if (tmpbuf == NULL) {
/* Too many callers don't check this result, we need to fill in the buffer with something */
- strlcpy((char *)dospwd, passwd, sizeof(dospwd));
+ strlcpy((char *)dospwd, passwd ? passwd : "", sizeof(dospwd));
E_P16(dospwd, p16);
return false;
}
/* write out a "standard" tar format header */
hb.dbuf.name[NAMSIZ-1]='\0';
- strlcpy(hb.dbuf.mode, amode, sizeof(hb.dbuf.mode));
+ strlcpy(hb.dbuf.mode, amode ? amode : "", sizeof(hb.dbuf.mode));
oct_it((uint64_t)0, 8, hb.dbuf.uid);
oct_it((uint64_t)0, 8, hb.dbuf.gid);
oct_it((uint64_t) size, 13, hb.dbuf.size);