When 'list == NULL && size == 0', the statement 'end = list + size'
executes 'NULL + 0'. clang's UndefinedBehaviorSanitizer complains that
this is undefined:
src/mount_image.c:1518:19: runtime error: applying zero offset to null pointer
This is questionable, but let's avoid it...
const struct wimfs_context *ctx = wimfs_get_context();
const struct wim_inode *inode;
char *p = list;
- char *end = list + size;
int total_size = 0;
if (!(ctx->mount_flags & WIMLIB_MOUNT_FLAG_STREAM_INTERFACE_XATTR))
total_size += stream_name_mbs_nbytes + 6;
if (size) {
- if (end - p < stream_name_mbs_nbytes + 6) {
+ if (list + size - p < stream_name_mbs_nbytes + 6) {
FREE(stream_name_mbs);
return -ERANGE;
}