From: Eric Biggers Date: Sat, 29 Jul 2017 20:39:28 +0000 (-0700) Subject: win32_apply: bail if paths are too long for a UNICODE_STRING X-Git-Tag: v1.12.0~1 X-Git-Url: https://wimlib.net/git/?a=commitdiff_plain;h=c0d3fd10d0cba3fedfa917e04d39a7803e34df6e;p=wimlib win32_apply: bail if paths are too long for a UNICODE_STRING --- diff --git a/src/win32_apply.c b/src/win32_apply.c index 96d9df6f..94285aca 100644 --- a/src/win32_apply.c +++ b/src/win32_apply.c @@ -1087,6 +1087,12 @@ prepare_target(struct list_head *dentry_list, struct win32_apply_ctx *ctx) 8 + 1 + 3); ctx->pathbuf.MaximumLength = path_max * sizeof(wchar_t); + if (ctx->pathbuf.MaximumLength != path_max * sizeof(wchar_t)) { + /* Paths are too long for a UNICODE_STRING! */ + ERROR("Some paths are too long to extract (> 32768 characters)!"); + return WIMLIB_ERR_UNSUPPORTED; + } + ctx->pathbuf.Buffer = MALLOC(ctx->pathbuf.MaximumLength); if (!ctx->pathbuf.Buffer) return WIMLIB_ERR_NOMEM;