diff options
author | kientzle <kientzle@FreeBSD.org> | 2005-09-21 04:25:06 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2005-09-21 04:25:06 +0000 |
commit | dcb8de96ab47d1932ce313adbac5a673210b1c91 (patch) | |
tree | 6f61f48765d8080ef9566d9cbfc0f3e97cefd834 /lib/libarchive/archive_write_set_format_pax.c | |
parent | b035b8b7b3780581ed55ea9ca0660c0af57f5a5b (diff) | |
download | FreeBSD-src-dcb8de96ab47d1932ce313adbac5a673210b1c91.zip FreeBSD-src-dcb8de96ab47d1932ce313adbac5a673210b1c91.tar.gz |
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
Diffstat (limited to 'lib/libarchive/archive_write_set_format_pax.c')
-rw-r--r-- | lib/libarchive/archive_write_set_format_pax.c | 3 |
1 files changed, 3 insertions, 0 deletions
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) { |