diff options
author | Anatoliy Belsky <ab@php.net> | 2012-06-04 21:30:04 +0200 |
---|---|---|
committer | Anatoliy Belsky <ab@php.net> | 2012-06-07 21:01:31 +0200 |
commit | 335a11b14b35e261c484d44a0e1b5ea9cc758e19 (patch) | |
tree | 515f54cede9e42804b4da1e1ef60d1d9f55bb633 /ext/zip/lib/zip_set_file_comment.c | |
parent | 7cae4ff02c593ed212a363d65c83c38a67a27f0d (diff) | |
download | php-git-335a11b14b35e261c484d44a0e1b5ea9cc758e19.tar.gz |
initial libzip upgrade patch to 0.10.1
Diffstat (limited to 'ext/zip/lib/zip_set_file_comment.c')
-rw-r--r-- | ext/zip/lib/zip_set_file_comment.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/ext/zip/lib/zip_set_file_comment.c b/ext/zip/lib/zip_set_file_comment.c index 3d5dd6b5e3..5e63dc2730 100644 --- a/ext/zip/lib/zip_set_file_comment.c +++ b/ext/zip/lib/zip_set_file_comment.c @@ -1,6 +1,6 @@ /* zip_set_file_comment.c -- set comment for file in archive - Copyright (C) 2006-2007 Dieter Baron and Thomas Klausner + Copyright (C) 2006-2009 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at <libzip@nih.at> @@ -40,17 +40,23 @@ ZIP_EXTERN(int) -zip_set_file_comment(struct zip *za, int idx, const char *comment, int len) +zip_set_file_comment(struct zip *za, zip_uint64_t idx, + const char *comment, int len) { char *tmpcom; - if (idx < 0 || idx >= za->nentry + if (idx >= za->nentry || len < 0 || len > MAXCOMLEN || (len > 0 && comment == NULL)) { _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; } + if (ZIP_IS_RDONLY(za)) { + _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); + return -1; + } + if (len > 0) { if ((tmpcom=(char *)_zip_memdup(comment, len, &za->error)) == NULL) return -1; |