The attached patch fixes an annoying, but not dangerous, off-by-one
error in the RNetShareEnum in smbd/lanman.c.  push_ascii() already takes
into account the null termination, so subtracting one from the size of
the destination buffer leaves us one byte short for the full string.
Although the truncation doesn't seem to matter much for the clients I've
tested with, applying this patch certainly eliminates a lot of noise 
from the logfiles.

Also, any time I give a password longer than 14 characters to smbclient, 
I get the same warning about truncated strings:

convert_string: Required 28, available 15

This is due to the usage of push_ascii() in
libsmb/smbencrypt.c:E_deshash().  Since the return value of push_ascii()
is discarded, I assume the error is also not fatal; so it seems to me
that before 3.0 is released, this debug statement ought to be reduced in 
severity.

Cheers,
Steve Langasek
postmodern programmer
diff -uNr samba-2.999+3.0.alpha20.orig/source/smbd/lanman.c 
samba-2.999+3.0.alpha20/source/smbd/lanman.c
--- samba-2.999+3.0.alpha20.orig/source/smbd/lanman.c   2002-10-04 14:56:51.000000000 
-0500
+++ samba-2.999+3.0.alpha20/source/smbd/lanman.c        2002-10-04 23:06:54.000000000 
+-0500
@@ -72,7 +72,7 @@
        StrnCpy(buf,src,sizeof(buf)/2);
        pstring_sub(buf,"%S",lp_servicename(snum));
        standard_sub_conn(conn,buf,sizeof(buf));
-       l = push_ascii(*dst,buf,*n-1, STR_TERMINATE);
+       l = push_ascii(*dst,buf,*n, STR_TERMINATE);
        (*dst) += l;
        (*n) -= l;
        return l;

Attachment: msg03533/pgp00000.pgp
Description: PGP signature

Reply via email to