Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Write to ini with Kill script using player's nick and join function not working right
Re: Write to ini with Kill script using player's nick and join function not working right [message #379224 is a reply to message #379208] Wed, 08 April 2009 04:11 Go to previous messageGo to previous message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma:
General (3 Stars)
Quote:


void Killed_Building_Script::Killed(GameObject *obj, GameObject *shooter){
       /*********why were those functions decs there? (compile error)***********/
	char *lpBuff = new char[256]; //MEMORY LEAK why even use the heap? use the stack instead (char lpBuff[256])
	int newamount = 1;
    int num = atoi(lpBuff); //USE OF UNINITIALIZED MEMORY (crash?)
    num -=  newamount;
    char buffer[50];
	char buildingid[16];
	sprintf(buildingid, "%d", Commands->Get_ID(obj)); //use %u for unsigned
    sprintf(buffer,"%d",num);
	char pName[256];
	GetPrivateProfileString("BuilderID", buildingid, "nick", lpBuff, 256, "C:\\westwood\\RenegadeFDS\\Server\\ID1.ini");
	char *lpBuff2 = new char[257]; //MEMORY LEAK why even use the heap? use the stack instead (char lpBuff2[256])
	char building[257];
	GetPrivateProfileString("BuildingID2", buildingid, "N", lpBuff2, 257, "C:\\westwood\\RenegadeFDS\\Server\\ID2.ini");
	char *lpBuff3 = new char[258]; //MEMORY LEAK why even use the heap? use the stack instead (char lpBuff3[256])
	GetPrivateProfileString(pName, building, "0", lpBuff3, 258, "C:\\westwood\\RenegadeFDS\\Server\\Buildings.ini"); //USE OF UNITIALIZED MEMORY (building)
	WritePrivateProfileString(pName, building, buffer, "C:\\westwood\\RenegadeFDS\\Server\\Buildings.ini"); //USE OF UNINITIALIZED MEMORY (building) 
}
ScriptRegistrant<Killed_Building_Script> Killed_Building_Script_Registrant("Killed_Building_Script","");




 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Glitch or No Glitch?
Next Topic: Mods
Goto Forum:
  


Current Time: Tue Jul 22 06:58:56 MST 2025

Total time taken to generate the page: 0.00890 seconds