From f279676b6b703f2fe618660041ebd7651d49336b Mon Sep 17 00:00:00 2001 From: Vreixo Formoso Date: Mon, 17 Dec 2007 20:47:53 +0100 Subject: [PATCH] Check file size to ensure file bigger than 4GB are not added to image. --- src/ecma119_tree.c | 8 ++++++++ src/error.h | 1 + src/filesrc.c | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/src/ecma119_tree.c b/src/ecma119_tree.c index 2566155..3b7736b 100644 --- a/src/ecma119_tree.c +++ b/src/ecma119_tree.c @@ -187,17 +187,25 @@ int create_tree(Ecma119Image *image, IsoNode *iso, Ecma119Node **tree, switch(iso->type) { case LIBISO_FILE: ret = create_file(image, (IsoFile*)iso, &node); + if (ret == ISO_FILE_TOO_BIG) { + free(iso_name); + // TODO log + return 0; + } break; case LIBISO_SYMLINK: //TODO only supported with RR + free(iso_name); return 0; break; case LIBISO_SPECIAL: //TODO only supported with RR + free(iso_name); return 0; break; case LIBISO_BOOT: //TODO + free(iso_name); return 0; break; case LIBISO_DIR: diff --git a/src/error.h b/src/error.h index 0bbe9d8..7907346 100644 --- a/src/error.h +++ b/src/error.h @@ -35,6 +35,7 @@ #define ISO_FILE_READ_ERROR -107 #define ISO_FILE_IS_NOT_DIR -108 #define ISO_FILE_IS_NOT_SYMLINK -109 +#define ISO_FILE_TOO_BIG -110 #define ISO_CHARSET_CONV_ERROR -150 diff --git a/src/filesrc.c b/src/filesrc.c index 7986afe..39f3d9e 100644 --- a/src/filesrc.c +++ b/src/filesrc.c @@ -71,6 +71,11 @@ int iso_file_src_create(Ecma119Image *img, IsoFile *file, IsoFileSrc **src) return ISO_FILE_ERROR; } + /* Files > 4GB not supported yet, they need ISO level 3 */ + if (size > (off_t)0xffffffff) { + return ISO_FILE_TOO_BIG; + } + fsrc = malloc(sizeof(IsoFileSrc)); if (fsrc == NULL) { return ISO_MEM_ERROR;