r1185 - in trunk/code: game qcommon
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Fri Sep 21 08:33:51 EDT 2007
Author: tma
Date: 2007-09-21 08:33:50 -0400 (Fri, 21 Sep 2007)
New Revision: 1185
Modified:
trunk/code/game/bg_lib.h
trunk/code/qcommon/q_shared.h
Log:
* (bug 3318) Restrict color escape characters to alphanumerics
Modified: trunk/code/game/bg_lib.h
===================================================================
--- trunk/code/game/bg_lib.h 2007-09-21 10:35:24 UTC (rev 1184)
+++ trunk/code/game/bg_lib.h 2007-09-21 12:33:50 UTC (rev 1185)
@@ -60,6 +60,22 @@
#define LONG_MAX 2147483647L /* maximum (signed) long value */
#define ULONG_MAX 0xffffffffUL /* maximum unsigned long value */
+#define isalnum(c) (isalpha(c) || isdigit(c))
+#define isalpha(c) (isupper(c) || islower(c))
+#define isascii(c) ((c) > 0 && (c) <= 0x7f)
+#define iscntrl(c) (((c) >= 0) && (((c) <= 0x1f) || ((c) == 0x7f)))
+#define isdigit(c) ((c) >= '0' && (c) <= '9')
+#define isgraph(c) ((c) != ' ' && isprint(c)
+#define islower(c) ((c) >= 'a' && (c) <= 'z')
+#define isprint(c) ((c) >= ' ' && (c) <= '~')
+#define ispunct(c) (((c) > ' ' && (c) <= '~') && !isalnum(c))
+#define isspace(c) ((c) == ' ' || (c) == '\f' || (c) == '\n' || (c) == '\r' || \
+ (c) == '\t' || (c) == '\v')
+#define isupper(c) ((c) >= 'A' && (c) <= 'Z')
+#define isxdigit(c) (isxupper(c) || isxlower(c))
+#define isxlower(c) (isdigit(c) || (c >= 'a' && c <= 'f'))
+#define isxupper(c) (isdigit(c) || (c >= 'A' && c <= 'F'))
+
// Misc functions
typedef int cmp_t(const void *, const void *);
void qsort(void *a, size_t n, size_t es, cmp_t *cmp);
Modified: trunk/code/qcommon/q_shared.h
===================================================================
--- trunk/code/qcommon/q_shared.h 2007-09-21 10:35:24 UTC (rev 1184)
+++ trunk/code/qcommon/q_shared.h 2007-09-21 12:33:50 UTC (rev 1185)
@@ -330,7 +330,7 @@
extern vec4_t colorDkGrey;
#define Q_COLOR_ESCAPE '^'
-#define Q_IsColorString(p) ( p && *(p) == Q_COLOR_ESCAPE && *((p)+1) && *((p)+1) != Q_COLOR_ESCAPE )
+#define Q_IsColorString(p) ( p && *(p) == Q_COLOR_ESCAPE && *((p)+1) && isalnum(*((p)+1)) ) // ^[0-9a-zA-Z]
#define COLOR_BLACK '0'
#define COLOR_RED '1'
More information about the quake3-commits
mailing list