diff options
Diffstat (limited to 'ext/zip/lib/zip_delete.c')
-rw-r--r-- | ext/zip/lib/zip_delete.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/ext/zip/lib/zip_delete.c b/ext/zip/lib/zip_delete.c index 4591ff7f8..131d44412 100644 --- a/ext/zip/lib/zip_delete.c +++ b/ext/zip/lib/zip_delete.c @@ -1,6 +1,6 @@ /* zip_delete.c -- delete file from zip archive - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-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> @@ -38,13 +38,18 @@ ZIP_EXTERN(int) -zip_delete(struct zip *za, int idx) +zip_delete(struct zip *za, zip_uint64_t idx) { - if (idx < 0 || idx >= za->nentry) { + if (idx >= za->nentry) { _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; + } + /* allow duplicate file names, because the file will * be removed directly afterwards */ if (_zip_unchange(za, idx, 1) != 0) |