View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0004616||unreal||ircd||public||2016-04-02 19:34||2016-04-02 19:34|
|Summary||0004616: Possible enhancement for channel_modes() function [src/channel.c]|
|Description||Hello, first and foremost I am sorry if there are any inaccuracies in this bug report, please point them out if there are any.|
Basically I came across the 'TODO' remark for this channel_modes() function and decided to help. I have divided this bug report to a few sections:
Enhancement we should consider:
1) Properly handle cases of insufficient memory space and avoid unnecessary CPU computation:
Instead of letting the function run from top to bottom of the code, there should be a 'return ()' when '!mbuf_size' or '!pbuf_size' is possible.
1a) Also, the code currently prints mode parameters to 'pbuf' even if the corresponding mode char cannot be printed to 'mbuf'.
2) If 'pbuf' and/or 'mbuf' does not have enough memory space, it will cause undesired output. The 'channel_modes()' function should have some kind of method to warn when such case occur.
3) Properly indicate that there is insufficient memory space:
'mbuf_size' and/or 'pbuf_size' should reset to 0 if negative value is found (especially at certain lines).
Low priority concern
4) Is there a reason why 'strlcat()' is not used in this 'channel_modes()' function? We really shouldn't make our lives difficult :P
Other than the concerns mentioned above, the code seems to be safe especially since ircsnprintf() is used for pbuf.
Thank you in advance!
|Tags||No tags attached.|
|3rd party modules|