Avoiding NULL pointer dereference in case of unexpected file type.

Coverity CID 12550.
This commit is contained in:
Thomas Schmitt 2015-10-11 17:36:30 +02:00
parent b904926443
commit ccef2f29da
3 changed files with 8 additions and 1 deletions

View File

@ -215,6 +215,9 @@ int default_create_node(IsoNodeBuilder *builder, IsoImage *image,
} }
} }
break; break;
default:
ret = ISO_BAD_FSRC_FILETYPE;
goto ex;
} }
if (ret < 0) if (ret < 0)

View File

@ -8712,6 +8712,8 @@ int iso_conv_name_chars(IsoWriteOpts *opts, char *name, size_t name_len,
/** General note (NOTE, HIGH, -414) */ /** General note (NOTE, HIGH, -414) */
#define ISO_GENERAL_NOTE 0xB030FE62 #define ISO_GENERAL_NOTE 0xB030FE62
/** Unrecognized file type of IsoFileSrc object (SORRY, HIGH, -415) */
#define ISO_BAD_FSRC_FILETYPE 0xE030FE61
/* Internal developer note: /* Internal developer note:
Place new error codes directly above this comment. Place new error codes directly above this comment.

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2007 Vreixo Formoso * Copyright (c) 2007 Vreixo Formoso
* Copyright (c) 2009 - 2014 Thomas Schmitt * Copyright (c) 2009 - 2015 Thomas Schmitt
* *
* This file is part of the libisofs project; you can redistribute it and/or * This file is part of the libisofs project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2 * modify it under the terms of the GNU General Public License version 2
@ -541,6 +541,8 @@ const char *iso_error_to_msg(int errcode)
return "File name truncation length changed by loaded image info"; return "File name truncation length changed by loaded image info";
case ISO_GENERAL_NOTE: case ISO_GENERAL_NOTE:
return "A general note message was issued"; return "A general note message was issued";
case ISO_BAD_FSRC_FILETYPE:
return "Unrecognized file type of IsoFileSrc object";
default: default:
return "Unknown error"; return "Unknown error";
} }