Signed-off-by: zhanghailiang <zhang.zhanghaili...@huawei.com> --- slirp/misc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/slirp/misc.c b/slirp/misc.c index b8eb74c..0109c9f 100644 --- a/slirp/misc.c +++ b/slirp/misc.c @@ -55,6 +55,9 @@ int add_exec(struct ex_list **ex_ptr, int do_pty, char *exec, tmp_ptr = *ex_ptr; *ex_ptr = (struct ex_list *)malloc(sizeof(struct ex_list)); + if (!ex_ptr) { + return -1; + } (*ex_ptr)->ex_fport = port; (*ex_ptr)->ex_addr = addr; (*ex_ptr)->ex_pty = do_pty; @@ -236,8 +239,9 @@ strdup(str) char *bptr; bptr = (char *)malloc(strlen(str)+1); - strcpy(bptr, str); - + if (bptr) { + strcpy(bptr, str); + } return bptr; } #endif -- 1.7.12.4