Bug #23169 wrong memset in some mysql file
Submitted: 11 Oct 2006 9:09 Modified: 7 Nov 2006 18:34
Reporter: Arkadiusz Miskiewicz (Basic Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1.11 OS:
Assigned to: Mads Martin Joergensen CPU Architecture:Any

[11 Oct 2006 9:09] Arkadiusz Miskiewicz
Description:
memset(FileName, sizeof(FileName), 0);

wrong order of arguments, ups!

How to repeat:
less DictTabInfo.cpp

Suggested fix:
[arekm@tarm ~/test/1/mysql-5.1.11-beta]$ diff -u ./storage/ndb/src/common/debugger/signaldata/DictTabInfo.cpp~ ./storage/ndb/src/common/debugger/signaldata/DictTabInfo.cpp
--- ./storage/ndb/src/common/debugger/signaldata/DictTabInfo.cpp~       2006-06-02 20:00:40.000000000 +0200
+++ ./storage/ndb/src/common/debugger/signaldata/DictTabInfo.cpp        2006-10-11 11:07:40.000000000 +0200
@@ -252,7 +252,7 @@

 void
 DictFilegroupInfo::File::init(){
-  memset(FileName, sizeof(FileName), 0);
+  memset(FileName, 0, sizeof(FileName));
   FileType = ~0;
   FileId = ~0;
   FileVersion = ~0;
[11 Oct 2006 10:12] Sveta Smirnova
Thank you for the report.

Verified as described using last BK sources:

ssmirnova@shella ~/mysql-5.1f
$cat storage/ndb/src/common/debugger/signaldata/DictTabInfo.cpp | grep memset
  memset(TableName, 0, sizeof(TableName));//TableName[0] = 0;
  memset(PrimaryTable, 0, sizeof(PrimaryTable));//PrimaryTable[0] = 0; // Only used when "index"
  memset(FrmData, 0, sizeof(FrmData));
  memset(FragmentData, 0, sizeof(FragmentData));
  memset(ReplicaData, 0, sizeof(ReplicaData));
  memset(RangeListData, 0, sizeof(RangeListData));
  memset(TablespaceData, 0, sizeof(TablespaceData));
  memset(AttributeName, 0, sizeof(AttributeName));//AttributeName[0] = 0;
  memset(AttributeDefaultValue, 0, sizeof(AttributeDefaultValue));//AttributeDefaultValue[0] = 0;
  memset(FilegroupName, 0, sizeof(FilegroupName));
  memset(TS_DataGrow.GrowPattern, 0, sizeof(TS_DataGrow.GrowPattern));
  memset(FileName, sizeof(FileName), 0);
[1 Nov 2006 14:56] Jonas Oreland
pushed into 5.1.13
[7 Nov 2006 18:34] Paul Dubois
Noted in 5.1.13 changelog.