[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-unstable-338-g9c3d105

Jeremy Allison jra at samba.org
Tue Nov 20 01:44:08 GMT 2007


The branch, v3-2-test has been updated
       via  9c3d10521e691169cfbb8b728f123911c3c970ae (commit)
      from  db9fa472a89eb78a7b1f7cabcf195331c3b448d9 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit 9c3d10521e691169cfbb8b728f123911c3c970ae
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Nov 19 17:43:28 2007 -0800

    Always check return from push_ascii.
    Jeremy.

-----------------------------------------------------------------------

Summary of changes:
 source/libsmb/clirap.c |    7 ++++++-
 source/smbd/lanman.c   |    6 ++++++
 2 files changed, 12 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/libsmb/clirap.c b/source/libsmb/clirap.c
index 9d106d0..848a8d5 100644
--- a/source/libsmb/clirap.c
+++ b/source/libsmb/clirap.c
@@ -216,6 +216,7 @@ bool cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
 	pstring param;
 	int uLevel = 1;
 	int count = -1;
+	size_t len;
 
 	errno = 0; /* reset */
 
@@ -235,7 +236,11 @@ bool cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
 	SIVAL(p,0,stype);
 	p += 4;
 
-	p += push_ascii(p, workgroup, sizeof(pstring)-PTR_DIFF(p,param)-1, STR_TERMINATE|STR_UPPER);
+	len = push_ascii(p, workgroup, sizeof(pstring)-PTR_DIFF(p,param)-1, STR_TERMINATE|STR_UPPER);
+	if (len == (size_t)-1) {
+		return false;
+	}
+	p += len;
 	
 	if (cli_api(cli, 
                     param, PTR_DIFF(p,param), 8,        /* params, length, max */
diff --git a/source/smbd/lanman.c b/source/smbd/lanman.c
index 4bd59a7..b2e435e 100644
--- a/source/smbd/lanman.c
+++ b/source/smbd/lanman.c
@@ -112,6 +112,9 @@ static int CopyExpanded(connection_struct *conn,
 		return 0;
 	}
 	l = push_ascii(*dst,buf,*p_space_remaining, STR_TERMINATE);
+	if (l == -1) {
+		return 0;
+	}
 	(*dst) += l;
 	(*p_space_remaining) -= l;
 	return l;
@@ -124,6 +127,9 @@ static int CopyAndAdvance(char **dst, char *src, int *n)
 		return 0;
 	}
 	l = push_ascii(*dst,src,*n, STR_TERMINATE);
+	if (l == -1) {
+		return 0;
+	}
 	(*dst) += l;
 	(*n) -= l;
 	return l;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list