svn commit: samba r14351 - in branches/SAMBA_3_0/source/client: .
jra at samba.org
jra at samba.org
Mon Mar 13 22:49:56 GMT 2006
Author: jra
Date: 2006-03-13 22:49:56 +0000 (Mon, 13 Mar 2006)
New Revision: 14351
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=14351
Log:
Ensure we use the minimum of PATH_MAX and sizeof(pstring).
Fix Coverity #59.
Jeremy.
Modified:
branches/SAMBA_3_0/source/client/client.c
Changeset:
Modified: branches/SAMBA_3_0/source/client/client.c
===================================================================
--- branches/SAMBA_3_0/source/client/client.c 2006-03-13 22:39:05 UTC (rev 14350)
+++ branches/SAMBA_3_0/source/client/client.c 2006-03-13 22:49:56 UTC (rev 14351)
@@ -2919,16 +2919,22 @@
info.text = text;
info.len = len;
- if (len >= PATH_MAX)
+ if (len >= MIN(PATH_MAX,sizeof(pstring))) {
return(NULL);
+ }
info.matches = SMB_MALLOC_ARRAY(char *,MAX_COMPLETIONS);
- if (!info.matches) return NULL;
+ if (!info.matches) {
+ return NULL;
+ }
info.matches[0] = NULL;
- for (i = len-1; i >= 0; i--)
- if ((text[i] == '/') || (text[i] == '\\'))
+ for (i = len-1; i >= 0; i--) {
+ if ((text[i] == '/') || (text[i] == '\\')) {
break;
+ }
+ }
+
info.text = text+i+1;
info.samelen = info.len = len-i-1;
@@ -2936,8 +2942,9 @@
strncpy(info.dirmask, text, i+1);
info.dirmask[i+1] = 0;
pstr_sprintf(dirmask, "%s%*s*", cur_dir, i-1, text);
- } else
+ } else {
pstr_sprintf(dirmask, "%s*", cur_dir);
+ }
if (cli_list(cli, dirmask, aDIR | aSYSTEM | aHIDDEN, completion_remote_filter, &info) < 0)
goto cleanup;
More information about the samba-cvs
mailing list