From: Eric Biggers Date: Sun, 21 Apr 2013 23:48:13 +0000 (-0500) Subject: Use REPARSE_POINT_MAX_SIZE macro X-Git-Tag: v1.3.3~55 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=897535f623ca66134269fe9487a3770d4486d880 Use REPARSE_POINT_MAX_SIZE macro --- diff --git a/src/ntfs-apply.c b/src/ntfs-apply.c index b9f6bf29..f794b4a2 100644 --- a/src/ntfs-apply.c +++ b/src/ntfs-apply.c @@ -362,7 +362,7 @@ apply_reparse_data(ntfs_inode *ni, struct wim_dentry *dentry, /* "Reparse point data, including the tag and optional GUID, cannot * exceed 16 kilobytes." - MSDN */ - if (wim_resource_size(lte) > (16 * 1024 - 8)) { + if (wim_resource_size(lte) > REPARSE_POINT_MAX_SIZE - 8) { ERROR("Reparse data of `%s' is too long (%"PRIu64" bytes)", dentry->_full_path, wim_resource_size(lte)); return WIMLIB_ERR_INVALID_DENTRY; diff --git a/src/symlink.c b/src/symlink.c index 538b3e85..9eaf6b4b 100644 --- a/src/symlink.c +++ b/src/symlink.c @@ -182,7 +182,7 @@ inode_readlink(const struct wim_inode *inode, char *buf, size_t buf_len, if (!lte) return -EIO; - if (wim_resource_size(lte) > 10000) + if (wim_resource_size(lte) > REPARSE_POINT_MAX_SIZE) return -EIO; u8 res_buf[wim_resource_size(lte)]; diff --git a/src/wimlib_internal.h b/src/wimlib_internal.h index 34d43fdc..29c5ea6b 100644 --- a/src/wimlib_internal.h +++ b/src/wimlib_internal.h @@ -72,6 +72,8 @@ struct sd_set; * yet. The differences between the versions are undocumented. */ #define WIM_VERSION 0x10d00 +#define REPARSE_POINT_MAX_SIZE (16 * 1024) + /* Metadata for a resource in a WIM file. */ struct resource_entry { /* Size, in bytes, of the resource in the WIM file. */ diff --git a/src/win32.c b/src/win32.c index 35026a56..77422249 100644 --- a/src/win32.c +++ b/src/win32.c @@ -614,7 +614,7 @@ win32_capture_reparse_point(HANDLE hFile, /* "Reparse point data, including the tag and optional GUID, * cannot exceed 16 kilobytes." - MSDN */ - char reparse_point_buf[16 * 1024]; + char reparse_point_buf[REPARSE_POINT_MAX_SIZE]; DWORD bytesReturned; if (!DeviceIoControl(hFile, FSCTL_GET_REPARSE_POINT,