diff options
author | Akira TAGOH <akira@tagoh.org> | 2018-07-19 07:50:20 +0000 |
---|---|---|
committer | Akira TAGOH <akira@tagoh.org> | 2018-07-19 07:50:20 +0000 |
commit | 1ac2218467260cc2f96f202910ba2e1a97291744 (patch) | |
tree | c37ac4613a3c20d93e94d904595556307dba373e | |
parent | f3981a8bcd97a0388bf150ea7c1b4a1015e5e358 (diff) | |
download | fontconfig-1ac2218467260cc2f96f202910ba2e1a97291744.tar.gz |
do not pass null pointer to memcpy
-rw-r--r-- | src/fccfg.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/fccfg.c b/src/fccfg.c index 31ed238..3d0356a 100644 --- a/src/fccfg.c +++ b/src/fccfg.c @@ -2109,7 +2109,8 @@ FcConfigXdgCacheHome (void) ret = malloc (len + 7 + 1); if (ret) { - memcpy (ret, home, len); + if (home) + memcpy (ret, home, len); memcpy (&ret[len], FC_DIR_SEPARATOR_S ".cache", 7); ret[len + 7] = 0; } @@ -2136,7 +2137,8 @@ FcConfigXdgConfigHome (void) ret = malloc (len + 8 + 1); if (ret) { - memcpy (ret, home, len); + if (home) + memcpy (ret, home, len); memcpy (&ret[len], FC_DIR_SEPARATOR_S ".config", 8); ret[len + 8] = 0; } @@ -2163,7 +2165,8 @@ FcConfigXdgDataHome (void) ret = malloc (len + 13 + 1); if (ret) { - memcpy (ret, home, len); + if (home) + memcpy (ret, home, len); memcpy (&ret[len], FC_DIR_SEPARATOR_S ".local" FC_DIR_SEPARATOR_S "share", 13); ret[len + 13] = 0; } |