diff options
author | Rene Mayrhofer <rene@mayrhofer.eu.org> | 2010-06-24 18:46:44 +0000 |
---|---|---|
committer | Rene Mayrhofer <rene@mayrhofer.eu.org> | 2010-06-24 18:46:44 +0000 |
commit | 1af6bb72455588a1fc3fb8ece47169c97f2456e2 (patch) | |
tree | bd2a8c37d28d79d3a3155134ce2d406fb39914ba /src/libstrongswan | |
parent | 552f653fdef8a6dc2ff2e3ac2ccedf711205fab2 (diff) | |
download | vyos-strongswan-1af6bb72455588a1fc3fb8ece47169c97f2456e2.tar.gz vyos-strongswan-1af6bb72455588a1fc3fb8ece47169c97f2456e2.zip |
Fix patch to actually apply.
Diffstat (limited to 'src/libstrongswan')
-rw-r--r-- | src/libstrongswan/credentials/ietf_attributes/ietf_attributes.c | 11 | ||||
-rw-r--r-- | src/libstrongswan/utils/identification.c | 12 |
2 files changed, 22 insertions, 1 deletions
diff --git a/src/libstrongswan/credentials/ietf_attributes/ietf_attributes.c b/src/libstrongswan/credentials/ietf_attributes/ietf_attributes.c index ff3ddeb6f..71dcd28f2 100644 --- a/src/libstrongswan/credentials/ietf_attributes/ietf_attributes.c +++ b/src/libstrongswan/credentials/ietf_attributes/ietf_attributes.c @@ -159,7 +159,7 @@ static char* get_string(private_ietf_attributes_t *this) enumerator = this->list->create_enumerator(this->list); while (enumerator->enumerate(enumerator, &attr)) { - int written = 0; + int written; if (first) { @@ -168,6 +168,10 @@ static char* get_string(private_ietf_attributes_t *this) else { written = snprintf(pos, len, ", "); + if (written < 0 || written >= len) + { + break; + } pos += written; len -= written; } @@ -194,8 +198,13 @@ static char* get_string(private_ietf_attributes_t *this) break; } default: + written = 0; break; } + if (written < 0 || written >= len) + { + break; + } pos += written; len -= written; } diff --git a/src/libstrongswan/utils/identification.c b/src/libstrongswan/utils/identification.c index 6a3c3936c..6ccfa193d 100644 --- a/src/libstrongswan/utils/identification.c +++ b/src/libstrongswan/utils/identification.c @@ -297,18 +297,30 @@ static void dntoa(chunk_t dn, char *buf, size_t len) { written = snprintf(buf, len,"%s=", oid_names[oid].name); } + if (written < 0 || written >= len) + { + break; + } buf += written; len -= written; chunk_printable(data, &printable, '?'); written = snprintf(buf, len, "%.*s", printable.len, printable.ptr); chunk_free(&printable); + if (written < 0 || written >= len) + { + break; + } buf += written; len -= written; if (data.ptr + data.len != dn.ptr + dn.len) { written = snprintf(buf, len, ", "); + if (written < 0 || written >= len) + { + break; + } buf += written; len -= written; } |