From dcb8de96ab47d1932ce313adbac5a673210b1c91 Mon Sep 17 00:00:00 2001 From: kientzle Date: Wed, 21 Sep 2005 04:25:06 +0000 Subject: Add a lot of error checks, based on the patches provided by Dan Lukes. Also fixes a memory leak reported by Andrew Turner. PR: bin/83476 Thanks to: Dan Lukes, Andrew Turner --- lib/libarchive/archive_write_set_format_pax.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/libarchive/archive_write_set_format_pax.c') diff --git a/lib/libarchive/archive_write_set_format_pax.c b/lib/libarchive/archive_write_set_format_pax.c index 54e8581..547ada9 100644 --- a/lib/libarchive/archive_write_set_format_pax.c +++ b/lib/libarchive/archive_write_set_format_pax.c @@ -208,6 +208,9 @@ add_pax_attr_w(struct archive_string *as, const char *key, const wchar_t *wval) } utf8_value = malloc(utf8len + 1); + if (utf8_value == NULL) + __archive_errx(1, "Not enough memory for attributes"); + for (wp = wval, p = utf8_value; *wp != L'\0'; ) { wc = *wp++; if (wc <= 0x7f) { -- cgit v1.1