talk_channel - Input lengths capped to 305 characters..no idea..
< Newer Topic
:: Older Topic >
Pages:<< prev 1 next >>
#1 Oct 26, 2023 6:09 am
GroupMembers
Posts10
JoinedOct 26, 2023
Hey guys, I'm running into a small problem with buffers. I honestly am at my wits end. I cannot for the life of me find out why buffers for channels is capped at 305 characters (this is for all channels btw) everything is set to MAX_INPUT_LENGTH and that is set to 4096 characters.. I've checked color codes I've checked all the buffer definitions, and I just cant figure it out. I've even checked all the input handling in handler.c everything has MSL or MIL for the for character caps...please if you know anything at all...please tell me what I'm missing..
#2 Oct 26, 2023 6:20 pm
Last edited Oct 26, 2023 6:22 pm by Vladaar
GroupMembers
Posts57
JoinedNov 24, 2016
[Sooc] 'thisisatesttoseehowmanycharacterscanbeinthisbuffer.Hopefullyalotmorethan305because305seemslikesuchatinyamountformaxinputlinebufferiguessiwillsoonseeif305istheactualnumberorifsomecrackpotisjustmakingupstuffonsmaugmuds.eitherwayitisinterestingtotest.hopefullywewillsee305isn'tthenumberthatmaxesoutthecharacerchannel.thisisatesttoseehowmanycharacterscanbeinthisbuffer.Hopefullyalotmorethan305because305seemslikesuchatinyamountformaxinputlinebufferiguessiwillsoonseeif305istheactualnumberorifsomecrackpotisjustmakingupstuffonsmaugmuds.eitherwayitisinterestingtotest.hopefullywewillsee305isn'tthenumberthatmaxesoutthecharacerchannel.'
https://wordcounter.net/
628 characters when I tested and didn't even max it. Although I am not using smaugfuss. We are heavily modified version of smaug which followed smaugfuss bug fixes and changes for quite a while. I have a really old version of 6Dragons codebase here. You could look at 6Dragons codebase for channel code maybe.
https://wordcounter.net/
628 characters when I tested and didn't even max it. Although I am not using smaugfuss. We are heavily modified version of smaug which followed smaugfuss bug fixes and changes for quite a while. I have a really old version of 6Dragons codebase here. You could look at 6Dragons codebase for channel code maybe.
#3 Oct 29, 2023 5:06 am
GroupMembers
Posts10
JoinedOct 26, 2023
I'm using Smaug 1.4 - So I don't think I have all the SmaugFUSS fixes and such..I've been using this codebase for almost 20 years I'm sure I've fixed a lot of things because it's not even smaug anymore at this point..
Where would I find this code?
SMAUG 1.4 (C) 1994, 1995, 1996, 1998 by Derek Snider
Where would I find this code?
SMAUG 1.4 (C) 1994, 1995, 1996, 1998 by Derek Snider
#4 Oct 29, 2023 10:15 am
GroupMembers
Posts57
JoinedNov 24, 2016
Well I don't have talk_channel anymore I use channels.c and channels.h
I don't see a problem with channels limited to 305 characters though, who needs more than that? Maybe smaugfuss did that to limit buffer overflows? Anyway this the link to the old codebase I used where you can find channels.c and channels.h
https://smaugmuds.afkmods.com/files/6dragons-44-496/
I don't see a problem with channels limited to 305 characters though, who needs more than that? Maybe smaugfuss did that to limit buffer overflows? Anyway this the link to the old codebase I used where you can find channels.c and channels.h
https://smaugmuds.afkmods.com/files/6dragons-44-496/
#5 Nov 2, 2023 8:37 am
GroupMembers
Posts10
JoinedOct 26, 2023
The reason for needing more than that is because I want people to be able to post paragraphs for my custom RP system. Instead of two sentence chunks.
#6 Nov 2, 2023 8:38 am
Last edited Nov 2, 2023 8:46 am by Seventeen
GroupMembers
Posts10
JoinedOct 26, 2023
I don't want your channel code, thanks though. I just want to know where it is I can modify it on Smaug. I do believe that is what I asked originally too. I just wanna use the existing system, I don't feel like adding a whole new channel system just to extend buffers.
#7 Nov 2, 2023 3:40 pm
Black Hand
GroupAdministrators
Posts3,697
JoinedJan 1, 2002
Text that gets sent to talk_channel is ultimately dumped into the lbuf[] array. That array has been stupidly set to MAX_INPUT_LENGTH when it's ultimately the value that gets carried forward into the act() function which actually distributed the message to the channel.
The big problem with this is that stock Smaug, even on the 1.8b update, is trying to strcat() the contents of buf[] which is using MAX_STRING_LENGTH. With a sufficiently long message this will result in the game crashing due to a buffer overrun.
This was mitigated in the FUSS forks by replacing all the unsafe uses of strcat() with a derivative of strlcat() which truncates content that would otherwise overflow the buffer. Unfortunately even in FUSS it was not noticed that lbuf[] is smaller so technically the contents of a super large message will get truncated due to the size mismatch.
In your case you're lucky all that's happening is that it's cutting you off at 305. That number is oddly specific and doesn't jive with what the code shows. You're still overrunning the buffer but for some reason your MUD doesn't seem to care? Either way that's a bad way to fly.
For the record, SmaugFUSS has not incorporated an alternate channel system even though doing so would be a good thing. So it's still using the same talk_channel function as always, just with all the bug fixes found over the years.
The big problem with this is that stock Smaug, even on the 1.8b update, is trying to strcat() the contents of buf[] which is using MAX_STRING_LENGTH. With a sufficiently long message this will result in the game crashing due to a buffer overrun.
This was mitigated in the FUSS forks by replacing all the unsafe uses of strcat() with a derivative of strlcat() which truncates content that would otherwise overflow the buffer. Unfortunately even in FUSS it was not noticed that lbuf[] is smaller so technically the contents of a super large message will get truncated due to the size mismatch.
In your case you're lucky all that's happening is that it's cutting you off at 305. That number is oddly specific and doesn't jive with what the code shows. You're still overrunning the buffer but for some reason your MUD doesn't seem to care? Either way that's a bad way to fly.
For the record, SmaugFUSS has not incorporated an alternate channel system even though doing so would be a good thing. So it's still using the same talk_channel function as always, just with all the bug fixes found over the years.
#8 Nov 3, 2023 6:06 pm
Last edited Nov 3, 2023 6:12 pm by Seventeen
GroupMembers
Posts10
JoinedOct 26, 2023
Since the last post...
before I answer and before this suggestion.. Thank you for making it clearer. I had already went through all that prior to reading this last comment. I was able to figure it out and rewrote the channel codes to better fit what was needed(about 6000 Characters). Thank you both for your suggestions. Sorry If I sounded like a jerk, i was stressing just trying to find answers without doing a major rework. But i just ended up doing just that to save myself the hassle.
https://game-scry.online/game/fighter%20adventure <-- please come see what I've done with smaug over the years.
before I answer and before this suggestion.. Thank you for making it clearer. I had already went through all that prior to reading this last comment. I was able to figure it out and rewrote the channel codes to better fit what was needed(about 6000 Characters). Thank you both for your suggestions. Sorry If I sounded like a jerk, i was stressing just trying to find answers without doing a major rework. But i just ended up doing just that to save myself the hassle.
https://game-scry.online/game/fighter%20adventure <-- please come see what I've done with smaug over the years.
#9 Nov 3, 2023 6:11 pm
GroupMembers
Posts10
JoinedOct 26, 2023
I've even written my own client because of smaug. because of this codebase being around I was able to learn C and become the coder I am today.. thank you so much!
Pages:<< prev 1 next >>