svn commit: samba r16605 - in trunk/source/libsmb: .
jra at samba.org
jra at samba.org
Wed Jun 28 04:27:37 GMT 2006
Author: jra
Date: 2006-06-28 04:27:37 +0000 (Wed, 28 Jun 2006)
New Revision: 16605
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16605
Log:
Klocwork #1990. Malloc the correct size.
Jeremy.
Modified:
trunk/source/libsmb/clirap2.c
Changeset:
Modified: trunk/source/libsmb/clirap2.c
===================================================================
--- trunk/source/libsmb/clirap2.c 2006-06-28 03:46:25 UTC (rev 16604)
+++ trunk/source/libsmb/clirap2.c 2006-06-28 04:27:37 UTC (rev 16605)
@@ -211,12 +211,21 @@
+WORDSIZE /* info level */
+WORDSIZE]; /* reserved word */
- char data[1024];
-
/* offset into data of free format strings. Will be updated */
/* by PUTSTRINGP macro and end up with total data length. */
int soffset = RAP_GROUPNAME_LEN + 1 + DWORDSIZE;
+ char *data;
+ size_t data_size;
+ /* Allocate data. */
+ data_size = MAX(soffset + strlen(grinfo->comment) + 1, 1024);
+
+ data = SMB_MALLOC(data_size);
+ if (!data) {
+ DEBUG (1, ("Malloc fail\n"));
+ return -1;
+ }
+
/* now send a SMBtrans command with api WGroupAdd */
p = make_header(param, RAP_WGroupAdd,
@@ -253,6 +262,7 @@
DEBUG(4,("NetGroupAdd failed\n"));
}
+ SAFE_FREE(data);
SAFE_FREE(rparam);
SAFE_FREE(rdata);
More information about the samba-cvs
mailing list