diff --git a/libisofs/fs_image.c b/libisofs/fs_image.c index c7e6868..24e6920 100644 --- a/libisofs/fs_image.c +++ b/libisofs/fs_image.c @@ -392,6 +392,8 @@ char* ifs_get_path(IsoFileSource *src) char *path, *new_path; int pathlen; + if (data->name == NULL) + return NULL; path = ifs_get_path(data->parent); if (path == NULL) return NULL; diff --git a/libisofs/fs_local.c b/libisofs/fs_local.c index a6611a0..765771c 100644 --- a/libisofs/fs_local.c +++ b/libisofs/fs_local.c @@ -517,6 +517,10 @@ int lfs_get_aa_string(IsoFileSource *src, unsigned char **aa_string, int flag) to AAIP ACL representation. Clean out st_mode ACL entries. */ path = iso_file_source_get_path(src); + if (path == NULL) { + ret = ISO_NULL_POINTER; + goto ex; + } ret = aaip_get_attr_list(path, &num_attrs, &names, &value_lengths, &values, (!(flag & 2)) | 2 | (flag & 4) | 16); diff --git a/libisofs/stream.c b/libisofs/stream.c index 00bcdb0..f250aa5 100644 --- a/libisofs/stream.c +++ b/libisofs/stream.c @@ -869,6 +869,10 @@ void iso_stream_get_file_name(IsoStream *stream, char *name) if (!strncmp(type, "fsrc", 4)) { FSrcStreamData *data = stream->data; char *path = iso_file_source_get_path(data->src); + if (path == NULL) { + name[0] = 0; + return; + } strncpy(name, path, PATH_MAX - 1); name[PATH_MAX - 1] = 0; free(path); diff --git a/libisofs/tree.c b/libisofs/tree.c index 60b8e23..cc04d43 100644 --- a/libisofs/tree.c +++ b/libisofs/tree.c @@ -761,11 +761,16 @@ int iso_add_dir_src_rec(IsoImage *image, IsoDir *parent, IsoFileSource *dir) ret = iso_file_source_open(dir); if (ret < 0) { - char *path = iso_file_source_get_path(dir); + path = iso_file_source_get_path(dir); /* instead of the probable error, we throw a sorry event */ - ret = iso_msg_submit(image->id, ISO_FILE_CANT_ADD, ret, - "Can't open dir %s", path); - free(path); + if (path != NULL) { + ret = iso_msg_submit(image->id, ISO_FILE_CANT_ADD, ret, + "Can't open dir %s", path); + free(path); + } else { + ret = iso_msg_submit(image->id, ISO_NULL_POINTER, ret, + "Can't open dir. NULL pointer caught as dir name"); + } return ret; } @@ -785,6 +790,11 @@ int iso_add_dir_src_rec(IsoImage *image, IsoDir *parent, IsoFileSource *dir) } path = iso_file_source_get_path(file); + if (path == NULL) { + ret = iso_msg_submit(image->id, ISO_NULL_POINTER, ret, + "NULL pointer caught as file path"); + return ret; + } name = strrchr(path, '/') + 1; if (image->follow_symlinks) {