xserver/xserver/os
desrt
freedesktop-cvs-commits@pdx.freedesktop.org
Wed, 03 Mar 2004 17:24:41 -0800
CVS commit by desrt:
mieq: fix lastEventTime code to prevent out-of-sequence events
utils: make VerifyDisplayName accept only integer values for display number
M +8 -7 xserver/xserver/os/utils.c 3.90
--- xserver/xserver/os/utils.c #3.89:3.90
@@ -584,10 +584,11 @@ static int
VerifyDisplayName(const char *d)
{
- if ( d == (char *)0 ) return( 0 ); /* null */
- if ( *d == '\0' ) return( 0 ); /* empty */
- if ( *d == '-' ) return( 0 ); /* could be confused for an option */
- if ( *d == '.' ) return( 0 ); /* must not equal "." or ".." */
- if ( strchr(d, '/') != (char *)0 ) return( 0 ); /* very important!!! */
- return( 1 );
+ if ( d == NULL || *d == '\0' ) /* NULL or empty */
+ return 0;
+ if ( d[0] == '0' && d[1] != '\0' ) /* disallow names like 01 */
+ return 0;
+ if ( strspn (d, "0123456789") != strlen (d) ) /* disallow non-numbers */
+ return 0;
+ return 1;
}