projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
str: Avoid passing null pointer to memcpy() in ds_put_substring().
[pspp]
/
src
/
libpspp
/
str.c
diff --git
a/src/libpspp/str.c
b/src/libpspp/str.c
index a58473192e44c1f7dc3cc59c2ac7b3e0deed373a..e06f6265712a0a8399050615431e6c6536fbf83f 100644
(file)
--- a/
src/libpspp/str.c
+++ b/
src/libpspp/str.c
@@
-1481,7
+1481,8
@@
ds_put_cstr (struct string *st, const char *s)
void
ds_put_substring (struct string *st, struct substring ss)
{
void
ds_put_substring (struct string *st, struct substring ss)
{
- memcpy (ds_put_uninit (st, ss_length (ss)), ss_data (ss), ss_length (ss));
+ if (ss.length)
+ memcpy (ds_put_uninit (st, ss_length (ss)), ss_data (ss), ss_length (ss));
}
/* Returns ds_end(ST) and THEN increases the length by INCR. */
}
/* Returns ds_end(ST) and THEN increases the length by INCR. */