Skip to content
Snippets Groups Projects
Commit 6c0e423a authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Don't truncate a user's record if the default download protocol or gender are '\0'

A blank download protocol field in a user.dat, when parsed, sets the 'prot' field
of user_t to 0. When writing the record back to the user.dat, this would prematurely
truncate all other fields off the user record (since strings in C are NUL terminated
and we're using sprintf() to format the record and %c specifier for that field).

The fix is to write a ' ' character instead of '\0' if the user_t.prot is '\0'.
As part of this fix, I'm writing a '?' if a user_t.sex is '\0' (not sure if this
is actually possible, but just as insurance). Those are the only 2 single-character
user properties/fields today.

Bug reported/debugged by Al of The Rusty Mailbox (1:153/757.2) - thank you!
parent e6017a35
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment