diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2019-10-13 00:51:50 +0900 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2019-10-13 00:51:50 +0900 |
commit | a5ecf7e0a165dff1b4604f1ed75a677c690488df (patch) | |
tree | 5bb23953c4fffab7edd6d06cc451ad21a9d9d2b4 /dir.c | |
parent | 90b9900dc159efb63feee9b0995cc5d56aef6d75 (diff) | |
download | bundler-a5ecf7e0a165dff1b4604f1ed75a677c690488df.tar.gz |
dir.c (join_path_from_pattern): check NULL from malloc
Coverity Scan points out that all the return values of GLOB_ALLOC_N are
NULL-checked except this call.
Diffstat (limited to 'dir.c')
-rw-r--r-- | dir.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -2072,8 +2072,10 @@ join_path_from_pattern(struct glob_pattern **beg) if (!path) { path_len = strlen(str); path = GLOB_ALLOC_N(char, path_len + 1); - memcpy(path, str, path_len); - path[path_len] = '\0'; + if (path) { + memcpy(path, str, path_len); + path[path_len] = '\0'; + } } else { size_t len = strlen(str); |