Made callers of iso_file_source_get_path() aware that NULL might be returned.
This commit is contained in:
parent
e7d9559d16
commit
d361186bca
@ -392,6 +392,8 @@ char* ifs_get_path(IsoFileSource *src)
|
|||||||
char *path, *new_path;
|
char *path, *new_path;
|
||||||
int pathlen;
|
int pathlen;
|
||||||
|
|
||||||
|
if (data->name == NULL)
|
||||||
|
return NULL;
|
||||||
path = ifs_get_path(data->parent);
|
path = ifs_get_path(data->parent);
|
||||||
if (path == NULL)
|
if (path == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -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.
|
to AAIP ACL representation. Clean out st_mode ACL entries.
|
||||||
*/
|
*/
|
||||||
path = iso_file_source_get_path(src);
|
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,
|
ret = aaip_get_attr_list(path, &num_attrs, &names,
|
||||||
&value_lengths, &values,
|
&value_lengths, &values,
|
||||||
(!(flag & 2)) | 2 | (flag & 4) | 16);
|
(!(flag & 2)) | 2 | (flag & 4) | 16);
|
||||||
|
@ -869,6 +869,10 @@ void iso_stream_get_file_name(IsoStream *stream, char *name)
|
|||||||
if (!strncmp(type, "fsrc", 4)) {
|
if (!strncmp(type, "fsrc", 4)) {
|
||||||
FSrcStreamData *data = stream->data;
|
FSrcStreamData *data = stream->data;
|
||||||
char *path = iso_file_source_get_path(data->src);
|
char *path = iso_file_source_get_path(data->src);
|
||||||
|
if (path == NULL) {
|
||||||
|
name[0] = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
strncpy(name, path, PATH_MAX - 1);
|
strncpy(name, path, PATH_MAX - 1);
|
||||||
name[PATH_MAX - 1] = 0;
|
name[PATH_MAX - 1] = 0;
|
||||||
free(path);
|
free(path);
|
||||||
|
@ -761,11 +761,16 @@ int iso_add_dir_src_rec(IsoImage *image, IsoDir *parent, IsoFileSource *dir)
|
|||||||
|
|
||||||
ret = iso_file_source_open(dir);
|
ret = iso_file_source_open(dir);
|
||||||
if (ret < 0) {
|
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 */
|
/* instead of the probable error, we throw a sorry event */
|
||||||
ret = iso_msg_submit(image->id, ISO_FILE_CANT_ADD, ret,
|
if (path != NULL) {
|
||||||
"Can't open dir %s", path);
|
ret = iso_msg_submit(image->id, ISO_FILE_CANT_ADD, ret,
|
||||||
free(path);
|
"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;
|
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);
|
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;
|
name = strrchr(path, '/') + 1;
|
||||||
|
|
||||||
if (image->follow_symlinks) {
|
if (image->follow_symlinks) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user