Review at https://gerrit.osmocom.org/4940
osmo_strlcpy: sanitize: don't memcpy from NULL src even if len is 0 Change-Id: I883048cf2807e606c6481634dbd569fc12aed889 --- M src/utils.c 1 file changed, 2 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/40/4940/1 diff --git a/src/utils.c b/src/utils.c index f63ff89..bc5329d 100644 --- a/src/utils.c +++ b/src/utils.c @@ -385,7 +385,8 @@ if (siz) { size_t len = (ret >= siz) ? siz - 1 : ret; - memcpy(dst, src, len); + if (src) + memcpy(dst, src, len); dst[len] = '\0'; } return ret; -- To view, visit https://gerrit.osmocom.org/4940 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I883048cf2807e606c6481634dbd569fc12aed889 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr <nhofm...@sysmocom.de>