From 008fd973097303ac984cd7c004e3dea67d54813d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 28 Sep 1998 23:55:09 +0000 Subject: Fixed problems found in lint pass over the old code by . These were the problems that still existed in the 2.0 branch. Jeremy. (This used to be commit 3fd28812f75f2311a114ff905143634e3bbb1fac) --- source3/client/clientutil.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'source3/client') diff --git a/source3/client/clientutil.c b/source3/client/clientutil.c index 2afbde85b5..7f5943cb01 100644 --- a/source3/client/clientutil.c +++ b/source3/client/clientutil.c @@ -105,6 +105,11 @@ BOOL cli_call_api(char *pipe_name, int pipe_name_len, if (!inbuf) inbuf = (char *)malloc(BUFFER_SIZE + SAFETY_MARGIN); if (!outbuf) outbuf = (char *)malloc(BUFFER_SIZE + SAFETY_MARGIN); + if(!inbuf || !outbuf) { + DEBUG(0,("cli_call_api: malloc fail.\n")); + return False; + } + if (pipe_name_len == 0) pipe_name_len = strlen(pipe_name); cli_send_trans_request(outbuf,SMBtrans,pipe_name, pipe_name_len, 0,0, @@ -152,6 +157,11 @@ BOOL cli_receive_trans_response(char *inbuf,int trans, *data = Realloc(*data,total_data); *param = Realloc(*param,total_param); + if((total_data && !data) || (total_param && !param)) { + DEBUG(0,("cli_receive_trans_response: Realloc fail !\n")); + return(False); + } + while (1) { this_data = SVAL(inbuf,smb_drcnt); @@ -458,10 +468,15 @@ BOOL cli_send_login(char *inbuf,char *outbuf,BOOL start_session,BOOL use_setup, bzero(&opt, sizeof(opt)); if (was_null) - { - inbuf = (char *)malloc(BUFFER_SIZE + SAFETY_MARGIN); - outbuf = (char *)malloc(BUFFER_SIZE + SAFETY_MARGIN); + { + inbuf = (char *)malloc(BUFFER_SIZE + SAFETY_MARGIN); + outbuf = (char *)malloc(BUFFER_SIZE + SAFETY_MARGIN); + + if(!inbuf || !outbuf) { + DEBUG(0,("cli_send_login: malloc fail !\n")); + return False; } + } if (strstr(service,"IPC$")) connect_as_ipc = True; -- cgit