Check for the right return value from sscanf.

This commit is contained in:
Nicholas Marriott 2012-02-05 22:23:13 +00:00
parent fe7cf0ba90
commit 3f49137f90

View File

@ -207,7 +207,7 @@ layout_construct(struct layout_cell *lcparent, const char **layout)
if (!isdigit((u_char) **layout)) if (!isdigit((u_char) **layout))
return (NULL); return (NULL);
if (sscanf(*layout, "%ux%u,%u,%u,%*u", &sx, &sy, &xoff, &yoff) != 5 && if (sscanf(*layout, "%ux%u,%u,%u,%*u", &sx, &sy, &xoff, &yoff) != 4 &&
sscanf(*layout, "%ux%u,%u,%u", &sx, &sy, &xoff, &yoff) != 4) sscanf(*layout, "%ux%u,%u,%u", &sx, &sy, &xoff, &yoff) != 4)
return (NULL); return (NULL);