projects
/
platform
/
upstream
/
libgc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5260eb0
)
Workaround 'potential non-terminated string' false positive in cordbscs
author
Ivan Maidanski
<ivmai@mail.ru>
Mon, 12 Nov 2018 08:12:09 +0000
(11:12 +0300)
committer
Ivan Maidanski
<ivmai@mail.ru>
Mon, 12 Nov 2018 17:45:19 +0000
(20:45 +0300)
* cordbscs.c [LINT2] (CORD_cat_char_star): Pass lenx+1 to memcpy()
instead of lenx; add comment.
cord/cordbscs.c
patch
|
blob
|
history
diff --git
a/cord/cordbscs.c
b/cord/cordbscs.c
index
ff0d239
..
a92ab63
100644
(file)
--- a/
cord/cordbscs.c
+++ b/
cord/cordbscs.c
@@
-170,7
+170,13
@@
CORD CORD_cat_char_star(CORD x, const char * y, size_t leny)
char * result = (char *)GC_MALLOC_ATOMIC(result_len + 1);
if (result == 0) OUT_OF_MEMORY;
- memcpy(result, x, lenx);
+# ifdef LINT2
+ memcpy(result, x, lenx + 1);
+# else
+ memcpy(result, x, lenx);
+ /* No need to copy the terminating zero */
+ /* as result[lenx] is written below. */
+# endif
memcpy(result + lenx, y, leny);
result[result_len] = '\0';
return((CORD) result);