select_wim_image(): Don't allow selecting WIMLIB_NO_IMAGE
authorEric Biggers <ebiggers3@gmail.com>
Sat, 24 Nov 2012 19:02:57 +0000 (13:02 -0600)
committerEric Biggers <ebiggers3@gmail.com>
Sat, 24 Nov 2012 19:02:57 +0000 (13:02 -0600)
src/wim.c

index cd024b1..117361c 100644 (file)
--- a/src/wim.c
+++ b/src/wim.c
@@ -207,6 +207,11 @@ int select_wim_image(WIMStruct *w, int image)
 
        DEBUG("Selecting image %d", image);
 
+       if (image == WIMLIB_NO_IMAGE) {
+               ERROR("Invalid image: %d", WIMLIB_NO_IMAGE);
+               return WIMLIB_ERR_INVALID_IMAGE;
+       }
+
        if (image == w->current_image)
                return 0;