X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Fwrite.c;h=07b557500b894ae70c770705b10d12500cdae5c2;hb=5c1b50fdca21aaaddbdb34f5f7beec7d67016984;hp=1df05c95402c7570802c6b2c6a3a83abe7b2aeee;hpb=66e2060915368055778438e3cacacee611a4b162;p=wimlib diff --git a/src/write.c b/src/write.c index 1df05c95..07b55750 100644 --- a/src/write.c +++ b/src/write.c @@ -2819,10 +2819,11 @@ wimlib_write(WIMStruct *wim, const tchar *path, int image, int write_flags, unsigned num_threads, wimlib_progress_func_t progress_func) { - if (!path) + if (write_flags & ~WIMLIB_WRITE_MASK_PUBLIC) return WIMLIB_ERR_INVALID_PARAM; - write_flags &= WIMLIB_WRITE_MASK_PUBLIC; + if (path == NULL || path[0] == T('\0')) + return WIMLIB_ERR_INVALID_PARAM; return write_standalone_wim(wim, path, image, write_flags, num_threads, progress_func); @@ -2834,10 +2835,12 @@ wimlib_write_to_fd(WIMStruct *wim, int fd, int image, int write_flags, unsigned num_threads, wimlib_progress_func_t progress_func) { + if (write_flags & ~WIMLIB_WRITE_MASK_PUBLIC) + return WIMLIB_ERR_INVALID_PARAM; + if (fd < 0) return WIMLIB_ERR_INVALID_PARAM; - write_flags &= WIMLIB_WRITE_MASK_PUBLIC; write_flags |= WIMLIB_WRITE_FLAG_FILE_DESCRIPTOR; return write_standalone_wim(wim, &fd, image, write_flags, @@ -3200,9 +3203,7 @@ wimlib_overwrite(WIMStruct *wim, int write_flags, int ret; u32 orig_hdr_flags; - write_flags &= WIMLIB_WRITE_MASK_PUBLIC; - - if (write_flags & WIMLIB_WRITE_FLAG_FILE_DESCRIPTOR) + if (write_flags & ~WIMLIB_WRITE_MASK_PUBLIC) return WIMLIB_ERR_INVALID_PARAM; if (!wim->filename)