Login
User Name:

Password:



Register

Forgot your password?
 IPv6
Jan 20, 2025 12:09 am
By Samson
mudstrlcpy and mudstrlcat
Jan 18, 2025 5:23 pm
By Samson
I3 and IMC
Jan 17, 2025 9:35 pm
By Samson
AFKMud 2.5.1
Jan 17, 2025 2:22 pm
By Samson
Array out of bounds ?
Jan 16, 2025 4:48 am
By Remcon
SmaugFUSS 1.9.7
Author: Various
Submitted by: Samson
AFKMud 2.5.1
Author: AFKMud Team
Submitted by: Samson
Kayle's Weather Code for AFKMud
Author: Kayle
Submitted by: Samson
AFKMud 2.5.0
Author: AFKMud Team
Submitted by: Samson
SWFotEFUSS 1.5.2
Author: Various
Submitted by: Samson
Users Online
Anthropic, Bing, Bytespider

Members: 0
Guests: 15
Stats
Files
Topics
Posts
Members
Newest Member
503
3,811
19,712
592
Abbey09S3

» SmaugMuds » Codebases » SmaugFUSS » mudstrlcpy and mudstrlcat
Forum Rules | Mark all | Recent Posts

mudstrlcpy and mudstrlcat
< Newer Topic :: Older Topic > Time for you to leave.

Pages:<< prev 1 next >>
Post is unread #1 Jan 18, 2025 4:33 pm   
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,705
JoinedJan 1, 2002

 
At some point in the past, a huge effort was expended to incorporate support for strlcpy and strlcat into all of the FUSS codebases (and AFKMud). Since these functions, at the time, were only available on OpenBSD systems, everyone else essentially had to hand roll their own versions. Which we did in the form of mudstrlcpy and mudstrlcat.

Fast forward to the modern age and apparently the strlcpy and strlcat functions were formally accepted into GlibC 2.38 in 2023. This means anyone compiling on GCC/G++ will have native access to versions of these functions without having to fiddle with hand rolling them anymore.

With that in mind I'm going to update all of the codebases to switch them over to the native calls. Fortunately that should be as easy as globally replacing the function names with the native versions, so at least we did something right back in the day :P

If you're unaware of why this even matters, these functions are safer alternatives to older things like strncpy() and strncat() which don't have NULL terminations built in.

Post is unread #2 Jan 18, 2025 4:53 pm   
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,705
JoinedJan 1, 2002

 
Heh, the payoff was immediate upon compiling AFKMud. It located 2 improper uses where our homebrew functions failed to identify buffer overruns during the compile.

I imagine it's likely to find similar in the rest of the bases.

Post is unread #3 Jan 18, 2025 5:23 pm   
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,705
JoinedJan 1, 2002

 
BTW, looking at some things a bit more closely, I think that str_dup should get the same treatment since it's literally duplicating the purpose of the standard C strdup function.

strdup was apparently added to GlibC in the very early 2000's so it's definitely much more widespread as a result.

Pages:<< prev 1 next >>