(svn r14410) -Codechange: one can't inject a negative number of parameters, so enforce this by using a uint.
authorrubidium
Sun, 28 Sep 2008 13:50:11 +0000
changeset 10197 fa185196aef1
parent 10196 889b923bbb96
child 10198 75f7455a4d4a
(svn r14410) -Codechange: one can't inject a negative number of parameters, so enforce this by using a uint.
src/strings.cpp
src/strings_func.h
--- a/src/strings.cpp	Sun Sep 28 12:38:56 2008 +0000
+++ b/src/strings.cpp	Sun Sep 28 13:50:11 2008 +0000
@@ -191,8 +191,9 @@
 	SetDParam(n, (uint64)(size_t)str);
 }
 
-void InjectDParam(int amount)
+void InjectDParam(uint amount)
 {
+	assert((uint)amount < lengthof(_decode_parameters));
 	memmove(_decode_parameters + amount, _decode_parameters, sizeof(_decode_parameters) - amount * sizeof(uint64));
 }
 
--- a/src/strings_func.h	Sun Sep 28 12:38:56 2008 +0000
+++ b/src/strings_func.h	Sun Sep 28 13:50:11 2008 +0000
@@ -11,7 +11,7 @@
 char *GetString(char *buffr, StringID string, const char *last);
 const char *GetStringPtr(StringID string);
 
-void InjectDParam(int amount);
+void InjectDParam(uint amount);
 
 static inline void SetDParamX(uint64 *s, uint n, uint64 v)
 {