mesa: Fix off-by-one error in Parse_TextureImageId.
[mesa.git] / src / mesa / program / nvfragparse.c
index bcc553a9bc67af738007cb4ab0cc468437d504ca..20c8579b08bc8bfe9ee84385cb551375d77ea82e 100644 (file)
@@ -582,7 +582,7 @@ Parse_TextureImageId(struct parse_state *parseState,
       RETURN_ERROR1("Expected TEX# source");
    }
    unit = atoi((const char *) imageSrc + 3);
-   if ((unit < 0 || unit > MAX_TEXTURE_IMAGE_UNITS) ||
+   if ((unit < 0 || unit >= MAX_TEXTURE_IMAGE_UNITS) ||
        (unit == 0 && (imageSrc[3] != '0' || imageSrc[4] != 0))) {
       RETURN_ERROR1("Invalied TEX# source index");
    }