Explorar el Código

* Fixed sql mapreg loading code specifying output buffer size for SqlStmt_BindColumn without zero-terminator, leading to truncations of variable names and/or their values when using the maximum length (bugreport:1939, since r11245).

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@14614 54d463be-8e91-2dee-dedb-b68131a5f0ec
ai4rei hace 14 años
padre
commit
951823bbde
Se han modificado 2 ficheros con 4 adiciones y 2 borrados
  1. 2 0
      Changelog-Trunk.txt
  2. 2 2
      src/map/mapreg_sql.c

+ 2 - 0
Changelog-Trunk.txt

@@ -1,5 +1,7 @@
 Date	Added
 
+2010/12/22
+	* Fixed sql mapreg loading code specifying output buffer size for SqlStmt_BindColumn without zero-terminator, leading to truncations of variable names and/or their values when using the maximum length (bugreport:1939, since r11245). [Ai4rei]
 2010/12/21
 	* Added script_setarray_pc for setting temporary character array variables outside of script.c without requiring them to use script-interal code (add_str and reference_uid). [Ai4rei]
 	- Applied script_setarray_pc to assignment of dynamic shop arrays (related r5841).

+ 2 - 2
src/map/mapreg_sql.c

@@ -122,9 +122,9 @@ static void script_load_mapreg(void)
 		return;
 	}
 
-	SqlStmt_BindColumn(stmt, 0, SQLDT_STRING, &varname[0], 32, &length, NULL);
+	SqlStmt_BindColumn(stmt, 0, SQLDT_STRING, &varname[0], sizeof(varname), &length, NULL);
 	SqlStmt_BindColumn(stmt, 1, SQLDT_INT, &index, 0, NULL, NULL);
-	SqlStmt_BindColumn(stmt, 2, SQLDT_STRING, &value[0], 255, NULL, NULL);
+	SqlStmt_BindColumn(stmt, 2, SQLDT_STRING, &value[0], sizeof(value), NULL, NULL);
 	
 	while ( SQL_SUCCESS == SqlStmt_NextRow(stmt) )
 	{