svn commit: samba r2361 - in branches/SAMBA_3_0/source: client lib
jra at samba.org
jra at samba.org
Wed Sep 15 22:49:25 GMT 2004
Author: jra
Date: 2004-09-15 22:49:23 +0000 (Wed, 15 Sep 2004)
New Revision: 2361
WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_3_0/source&rev=2361&nolog=1
Log:
Fix the appalling toktocliplist() fn. Bug found by Luis Benvenutto.
Jeremy.
Modified:
branches/SAMBA_3_0/source/client/clitar.c
branches/SAMBA_3_0/source/lib/util_str.c
Changeset:
Modified: branches/SAMBA_3_0/source/client/clitar.c
===================================================================
--- branches/SAMBA_3_0/source/client/clitar.c 2004-09-15 22:49:18 UTC (rev 2360)
+++ branches/SAMBA_3_0/source/client/clitar.c 2004-09-15 22:49:23 UTC (rev 2361)
@@ -1345,8 +1345,9 @@
int cmd_tar(void)
{
fstring buf;
- char **argl;
- int argcl;
+ char **argl = NULL;
+ int argcl = 0;
+ int ret;
if (!next_token_nr(NULL,buf,NULL,sizeof(buf))) {
DEBUG(0,("tar <c|x>[IXbgan] <filename>\n"));
@@ -1357,8 +1358,9 @@
if (!tar_parseargs(argcl, argl, buf, 0))
return 1;
+ ret = process_tar();
SAFE_FREE(argl);
- return process_tar();
+ return ret;
}
/****************************************************************************
Modified: branches/SAMBA_3_0/source/lib/util_str.c
===================================================================
--- branches/SAMBA_3_0/source/lib/util_str.c 2004-09-15 22:49:18 UTC (rev 2360)
+++ branches/SAMBA_3_0/source/lib/util_str.c 2004-09-15 22:49:23 UTC (rev 2361)
@@ -134,17 +134,20 @@
*ctok=ictok;
s=(char *)last_ptr;
- if (!(ret=iret=malloc(ictok*sizeof(char *))))
+ if (!(ret=iret=malloc((ictok+1)*sizeof(char *))))
return NULL;
while(ictok--) {
*iret++=s;
- while(*s++)
- ;
- while(!*s)
- s++;
+ if (ictok > 0) {
+ while(*s++)
+ ;
+ while(!*s)
+ s++;
+ }
}
+ ret[*ctok] = NULL;
return ret;
}
More information about the samba-cvs
mailing list