svn commit: samba r21239 - in branches/SAMBA_3_0/source/libsmb: .
idra at samba.org
idra at samba.org
Thu Feb 8 14:55:23 GMT 2007
Author: idra
Date: 2007-02-08 14:55:21 +0000 (Thu, 08 Feb 2007)
New Revision: 21239
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=21239
Log:
if the workgroup name is longer than 16 chars we get garbage in the string
server_len is usually 256 (fstring).
Correctly terminate saving the lenght
Modified:
branches/SAMBA_3_0/source/libsmb/libsmbclient.c
Changeset:
Modified: branches/SAMBA_3_0/source/libsmb/libsmbclient.c
===================================================================
--- branches/SAMBA_3_0/source/libsmb/libsmbclient.c 2007-02-08 13:50:47 UTC (rev 21238)
+++ branches/SAMBA_3_0/source/libsmb/libsmbclient.c 2007-02-08 14:55:21 UTC (rev 21239)
@@ -339,14 +339,15 @@
goto decoding;
if (*p == '/') {
+ int wl = strlen(context->workgroup);
- strncpy(server, context->workgroup,
- ((strlen(context->workgroup) < 16)
- ? strlen(context->workgroup)
- : 16));
- server[server_len - 1] = '\0';
+ if (wl > 16) {
+ wl = 16;
+ }
+
+ strncpy(server, context->workgroup, wl);
+ server[wl] = '\0';
return 0;
-
}
/*
More information about the samba-cvs
mailing list