From ce0d35d6ae9415bac3e3ba6b521edc0a83cb7c78 Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Mon, 15 Apr 2013 15:08:24 +0000 Subject: [PATCH] - unbound-anchor review: BIO_write can return 0 successfully if it has successfully appended a zero length string. git-svn-id: file:///svn/unbound/trunk@2884 be551aaa-1e26-0410-a405-d3ace91eadb9 --- doc/Changelog | 2 ++ smallapp/unbound-anchor.c | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index 6b931e996..e0fd36427 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,6 +1,8 @@ 15 April 2013: Wouter - Fix so that for a configuration line of include: "*.conf" it is not an error if there are no files matching the glob pattern. + - unbound-anchor review: BIO_write can return 0 successfully if it + has successfully appended a zero length string. 11 April 2013: Wouter - Fix queries leaking up for stubs and forwards, if the configured diff --git a/smallapp/unbound-anchor.c b/smallapp/unbound-anchor.c index ef0031c94..2b6d4232b 100644 --- a/smallapp/unbound-anchor.c +++ b/smallapp/unbound-anchor.c @@ -1231,7 +1231,7 @@ xml_charhandle(void *userData, const XML_Char *s, int len) printf("'\n"); } if(strcasecmp(data->tag, "Zone") == 0) { - if(BIO_write(data->czone, s, len) <= 0) { + if(BIO_write(data->czone, s, len) < 0) { if(verb) printf("out of memory in BIO_write\n"); exit(0); } @@ -1242,7 +1242,7 @@ xml_charhandle(void *userData, const XML_Char *s, int len) return; b = xml_selectbio(data, data->tag); if(b) { - if(BIO_write(b, s, len) <= 0) { + if(BIO_write(b, s, len) < 0) { if(verb) printf("out of memory in BIO_write\n"); exit(0); } @@ -1435,7 +1435,7 @@ xml_startelem(void *userData, const XML_Char *name, const XML_Char **atts) static void xml_append_str(BIO* b, const char* s) { - if(BIO_write(b, s, (int)strlen(s)) <= 0) { + if(BIO_write(b, s, (int)strlen(s)) < 0) { if(verb) printf("out of memory in BIO_write\n"); exit(0); } @@ -1459,7 +1459,7 @@ xml_append_bio(BIO* b, BIO* a) z[i] = ' '; } /* write to BIO */ - if(BIO_write(b, z, len) <= 0) { + if(BIO_write(b, z, len) < 0) { if(verb) printf("out of memory in BIO_write\n"); exit(0); } @@ -1545,7 +1545,7 @@ xml_parse_setup(XML_Parser parser, struct xml_data* data, time_t now) } snprintf(buf, sizeof(buf), "; created by unbound-anchor on %s", ctime(&now)); - if(BIO_write(data->ds, buf, (int)strlen(buf)) <= 0) { + if(BIO_write(data->ds, buf, (int)strlen(buf)) < 0) { if(verb) printf("out of memory\n"); exit(0); } -- 2.47.2