[Commit] rrserver dispatch.5c,1.31,1.32
Keith Packard
commit at keithp.com
Thu Jun 16 12:36:48 PDT 2005
Committed by: keithp
Update of /local/src/CVS/rrserver
In directory home.keithp.com:/local/bin/rrserver
Modified Files:
dispatch.5c
Log Message:
Check argument array bounds
Index: dispatch.5c
===================================================================
RCS file: /local/src/CVS/rrserver/dispatch.5c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- dispatch.5c 16 Jun 2005 18:10:45 -0000 1.31
+++ dispatch.5c 16 Jun 2005 19:36:45 -0000 1.32
@@ -157,6 +157,8 @@
describe =
"List players in the indicated game and their current score.\n",
f = void func (string[] w) {
+ if (dim (w) == 0)
+ raise rr_error (Error.SYNTAX);
string game = w[0];
assert_user ();
&Game g = &Games::find (game);
@@ -171,6 +173,8 @@
describe =
"List users watching the indicated game.\n",
f = void func (string[] w) {
+ if (dim (w) == 0)
+ raise rr_error (Error.SYNTAX);
string game = w[0];
assert_user ();
&Game g = &Games::find (game);
@@ -200,6 +204,8 @@
"<bid> is valid in all but NEW state where it's 0\n"+
"<active> is valid in SHOW and SOLVED states, else it's \"\".\n",
f = void func (string[] w) {
+ if (dim (w) == 0)
+ raise rr_error (Error.SYNTAX);
string game = w[0];
assert_user ();
&Game g = &Games::find (game);
@@ -250,6 +256,8 @@
"<bid> is either \"0\" indicating no bid or a number indicating\n"+
"the users minimum bid.\n",
f = void func (string[] w) {
+ if (dim (w) == 0)
+ raise rr_error (Error.SYNTAX);
string username = w[0];
assert_user ();
ClientRef cr = Clients::find (username);
@@ -286,6 +294,8 @@
"Create new game. <game-suggestion> will be used to construct\n"+
"the game name.\n",
f = void func (string[] w) {
+ if (dim (w) == 0)
+ raise rr_error (Error.SYNTAX);
string game=w[0];
assert_user ();
&Game g = &Games::new (game);
@@ -299,6 +309,8 @@
describe =
"Join an existing game.\n",
f = void func (string[] w) {
+ if (dim (w) == 0)
+ raise rr_error (Error.SYNTAX);
string game=w[0];
assert_user ();
&Game g = &Games::find (game);
@@ -312,6 +324,8 @@
describe =
"Watch an existing game.\n",
f = void func (string[] w) {
+ if (dim (w) == 0)
+ raise rr_error (Error.SYNTAX);
string game=w[0];
assert_user ();
&Game g = &Games::find (game);
@@ -325,6 +339,8 @@
describe =
"Dispose an empty game.\n",
f = void func (string[] w) {
+ if (dim (w) == 0)
+ raise rr_error (Error.SYNTAX);
string game=w[0];
assert_user ();
&Game g = &Games::find (game);
@@ -380,6 +396,8 @@
describe =
"Make a bid on the current turn.\n",
f = void func (string[] w) {
+ if (dim (w) == 0)
+ raise rr_error (Error.SYNTAX);
int number = string_to_integer (w[0]);
assert_user ();
assert_game ();
@@ -433,6 +451,8 @@
"Move the robot indicated by <color> in the indicated\n"+
"sequence of directions.\n",
f = void func (string[] w) {
+ if (dim (w) == 0)
+ raise rr_error (Error.SYNTAX);
Color col = color(w[0]);
Direction[dim(w)-1] directions = {
[i] = direction(w[i+1])
@@ -509,6 +529,8 @@
describe =
"Broadcast <text> to all users.\n",
f = void func (string[] w) {
+ if (dim (w) == 0)
+ raise rr_error (Error.SYNTAX);
assert_user ();
respond ("MESSAGE\n");
string text = w[0];
@@ -587,6 +609,8 @@
describe =
"Negotiate protocol version.\n",
f = void func (string[] w) {
+ if (dim (w) == 0)
+ raise rr_error (Error.SYNTAX);
int version = min (string_to_integer (w[0],
server_version));
c.version = version;
More information about the Commit
mailing list