projects
/
pspp
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6cdb732
)
str: Avoid passing null pointer to memcpy() in ds_put_substring().
author
Ben Pfaff
<blp@cs.stanford.edu>
Mon, 25 Jan 2021 00:30:42 +0000
(16:30 -0800)
committer
Ben Pfaff
<blp@cs.stanford.edu>
Mon, 25 Jan 2021 00:51:58 +0000
(16:51 -0800)
src/libpspp/str.c
patch
|
blob
|
history
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)
{
- 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. */