[SCM] Resolv Wrapper Repository - branch master updated

Andreas Schneider asn at samba.org
Tue Dec 2 03:00:51 MST 2014


The branch, master has been updated
       via  0cc723f tests: Add an invalid record to the fake_hosts file for tests
       via  c1dc787 rwrap: Don't dereference NULL when skipping broken records
      from  12f2b9c tests: Define MIN if not available.

https://git.samba.org/?p=resolv_wrapper.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 0cc723fa549295fc49d89080208af2e54630c6e6
Author: Jakub Hrozek <jakub.hrozek at gmail.com>
Date:   Tue Dec 2 10:37:01 2014 +0100

    tests: Add an invalid record to the fake_hosts file for tests
    
    To make sure rwrap is able to skip invalid records as appropriate.
    
    Signed-off-by: Jakub Hrozek <jakub.hrozek at gmail.com>
    Reviewed-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit c1dc787363bb1f43cf78666a50d1ef2595f891cf
Author: Jakub Hrozek <jakub.hrozek at gmail.com>
Date:   Tue Dec 2 10:35:49 2014 +0100

    rwrap: Don't dereference NULL when skipping broken records
    
    CID: 83426
    CID: 83425
    
    Signed-off-by: Jakub Hrozek <jakub.hrozek at gmail.com>
    Reviewed-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

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

Summary of changes:
 src/resolv_wrapper.c | 12 ++++++------
 tests/fake_hosts.in  |  1 +
 2 files changed, 7 insertions(+), 6 deletions(-)


Changeset truncated at 500 lines:

diff --git a/src/resolv_wrapper.c b/src/resolv_wrapper.c
index a0b2821..7211ad0 100644
--- a/src/resolv_wrapper.c
+++ b/src/resolv_wrapper.c
@@ -678,12 +678,6 @@ static int rwrap_get_record(const char *hostfile, unsigned recursion,
 		NEXT_KEY(rec_type, key);
 		NEXT_KEY(key, value);
 
-		q = value;
-		while(q[0] != '\n' && q[0] != '\0') {
-			q++;
-		}
-		q[0] = '\0';
-
 		if (key == NULL || value == NULL) {
 			RWRAP_LOG(RWRAP_LOG_WARN,
 				"Malformed line: not enough parts, use \"rec_type key data\n"
@@ -691,6 +685,12 @@ static int rwrap_get_record(const char *hostfile, unsigned recursion,
 			continue;
 		}
 
+		q = value;
+		while(q[0] != '\n' && q[0] != '\0') {
+			q++;
+		}
+		q[0] = '\0';
+
 		if (TYPE_MATCH(type, ns_t_a, rec_type, "A", key, query)) {
 			rc = rwrap_create_fake_a_rr(key, value, rr);
 			break;
diff --git a/tests/fake_hosts.in b/tests/fake_hosts.in
index 80951ba..e441f0e 100644
--- a/tests/fake_hosts.in
+++ b/tests/fake_hosts.in
@@ -1,3 +1,4 @@
+A brokenrecord.com
 A cwrap.org 127.0.0.21
 AAAA cwrap6.org 2a00:1450:4013:c01::63
 SRV _ldap._tcp.cwrap.org ldap.cwrap.org 389 1 5


-- 
Resolv Wrapper Repository


More information about the samba-cvs mailing list