r23779: Change from v2 or later to v3 or later.
[abartlet/samba.git/.git] / source3 / libsmb / clientgen.c
index 9021d1a36280ba678ac03df4f249b395addd87f8..282ebb7cb99002dec648439fdbefcaae5ce43471 100644 (file)
@@ -6,7 +6,7 @@
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
@@ -133,7 +133,7 @@ BOOL cli_receive_smb_internal(struct cli_state *cli, BOOL eat_keepalives)
        }
 
        /* If the server is not responding, note that now */
-       if (len <= 0) {
+       if (len < 0) {
                 DEBUG(0, ("Receiving SMB: Server stopped responding\n"));
                cli->smb_rw_error = smb_read_error;
                close(cli->fd);
@@ -234,7 +234,8 @@ BOOL cli_receive_smb_readX_header(struct cli_state *cli)
                        }
 
                        /* Read the rest of the data. */
-                       if (!cli_receive_smb_data(cli,cli->inbuf+len,total_len - len)) {
+                       if ((total_len - len > 0) &&
+                           !cli_receive_smb_data(cli,cli->inbuf+len,total_len - len)) {
                                goto read_err;
                        }