Raised This Month: $12 Target: $400
 3% 

Solved Buffer overflow caused by using set_task incorrectly


Post New Thread Reply   
 
Thread Tools Display Modes
Natsheh
Veteran Member
Join Date: Sep 2012
Old 11-30-2021 , 00:46   Re: adminhelp error invalid id
Reply With Quote #11

Quote:
Originally Posted by fysiks View Post
Where is your proof for claiming such a thing?
The unexpected behavior.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 11-30-2021 , 01:43   Re: adminhelp error invalid id
Reply With Quote #12

Quote:
Originally Posted by Natsheh View Post
The unexpected behavior.
A memory leak does not cause unexpected brhavior. It just wastes memory.
__________________

Last edited by HamletEagle; 11-30-2021 at 01:43.
HamletEagle is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 11-30-2021 , 03:12   Re: adminhelp error invalid id
Reply With Quote #13

Quote:
Originally Posted by HamletEagle View Post
A memory leak does not cause unexpected brhavior. It just wastes memory.
Well then what do cause these unexpected behaviors?

Also doesn't memory leak cause mem addresses to be overwritten?
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 11-30-2021 at 03:30.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 11-30-2021 , 04:32   Re: adminhelp error invalid id
Reply With Quote #14

Quote:
Originally Posted by Natsheh View Post
Well then what do cause these unexpected behaviors?
I don't know what caused your particular error, it needs to be investigated. You didn't even post the line where this error occurs(debug would have shown that).


Quote:
Originally Posted by Natsheh View Post
Also doesn't memory leak cause mem addresses to be overwritten?
No, a memory leak happens when memory is being allocated/reserved for use by a particular process and never freed. That memory is still owned by the process so no other process can get access to it. If the leaked block is big or if the leak happens often and the program runs for a long time, the leaks add up and may cause the system to run out of memory. At this point, things will stop working(when programs request memory the OS can not allocate any so the code will fail) or get slowed down significantly if swapping between ram and disk occurs.

You are probably thinking about something like a buffer overflow, where you attempt to write more data than a buffer can handle and without proper care, it may end up writing memory outside the allocated buffer, overwriting other areas of memory and potentially corrupting it or allowing attackers to exploit the application. There is a very common and basic example in C regarding a buffer overflow/index out of bounds(assume the compiler does not do any reordering when placing the variables on stack):

PHP Code:
int buf[5];
int a;

//on stack, if no reordering occurs, we have buf[0] buf[1] buf[2] buf[3] buf[4] a

5;

buf[0] = 11;
buf[1] = 12;
buf[2] = 13;
buf[3] = 14;
buf[4] = 15;

//now memory holds 11 12 13 14 15 5

//5 is not a valid index inside buf, it is an attempt to write outside the buffer
//since a is allocated right after buf, writing to buf[5] will actually overwrite a
buf[5] = 100;

//now a is 100, not 5

//again, this is under the assumption that no reordering occurs and a is placed after buf. if a didn't exist and buf[5] address would land in a page that the process does not own(not yet allocated) the program would likely crash with a segmentation fault signal 
__________________

Last edited by HamletEagle; 11-30-2021 at 04:46.
HamletEagle is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 11-30-2021 , 04:43   Re: adminhelp error invalid id
Reply With Quote #15

Quote:
Originally Posted by Natsheh View Post
This is caused by a memory leak, but i am not sure why the player id is 100 and what causing the leak.
Player index 100 can be caused by one of your plugins because you are using ClientPutInServer engfunc and an entity is connecting. In your plugin using this method you pass a malformed index as entity's index and that is causing the error of client_print() native:
PHP Code:
Error
If a single client is specified and the index is not within
the range of 1 to MaxClients
an error will be thrown
http://www.amxmodx.org/api/amxmodx/client_print

There is no memory leak or something else, just a coding mistake.
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 11-30-2021 , 04:45   Re: adminhelp error invalid id
Reply With Quote #16

Wow that was very nice explanation to what be the caused i have alot of doubts this might be issue thanks again hamlet !

Thanks for the pointing shadowali ill check it out.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 11-30-2021 at 04:46.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
thEsp
BANNED
Join Date: Aug 2017
Old 11-30-2021 , 15:30   Re: adminhelp error invalid id
Reply With Quote #17

Quote:
Originally Posted by Shadows Adi View Post
Player index 100 can be caused by one of your plugins...
It can't be from another plugin when it's a function from the core module. As I said it's a bug within the game (HLDS) or AMXX (if it's just client_putinserver malfunctioning then so is the case).
thEsp is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 12-01-2021 , 15:06   Re: adminhelp error invalid id
Reply With Quote #18

Seems the problem was caused by using set_task 5th parameter charsmax instead of sizeof in some of the plugins.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-01-2021 , 21:54   Re: adminhelp error invalid id
Reply With Quote #19

Quote:
Originally Posted by Natsheh View Post
Seems the problem was caused by using set_task 5th parameter charsmax instead of sizeof in some of the plugins.
Which plugins?
__________________

Last edited by fysiks; 12-01-2021 at 21:54.
fysiks is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 12-02-2021 , 03:32   Re: adminhelp error invalid id
Reply With Quote #20

The plugins from jb mod.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:03.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode