[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src random.cpp
From: |
Guillaume Melquiond |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src random.cpp |
Date: |
Sat, 30 Apr 2005 03:56:44 -0400 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Guillaume Melquiond <address@hidden> 05/04/30 07:56:44
Modified files:
src : random.cpp
Log message:
Enforce the range of random numbers, in order to avoid some OoS if a
serialized value is out of range on the target computer.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/random.cpp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
Patches:
Index: wesnoth/src/random.cpp
diff -u wesnoth/src/random.cpp:1.2 wesnoth/src/random.cpp:1.3
--- wesnoth/src/random.cpp:1.2 Sat Apr 23 12:13:10 2005
+++ wesnoth/src/random.cpp Sat Apr 30 07:56:44 2005
@@ -1,4 +1,4 @@
-/* $Id: random.cpp,v 1.2 2005/04/23 12:13:10 gruikya Exp $ */
+/* $Id: random.cpp,v 1.3 2005/04/30 07:56:44 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Copyright (C) 2005 by Yann Dirson <address@hidden>
@@ -35,7 +35,7 @@
if(random == NULL) {
int res = value;
if(value < 0)
- res = rand();
+ res = rand() & 0x7FFFFFFF;
random_ = &random_->add_child("random");
char buf[100];
@@ -44,7 +44,7 @@
return res;
} else {
- const int res = atol((*random)["value"].c_str());
+ const int res = atoi((*random)["value"].c_str());
random_ = random;
return res;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Wesnoth-cvs-commits] wesnoth/src random.cpp,
Guillaume Melquiond <=