Dwarf Fortress Bug Tracker - Dwarf Fortress
View Issue Details
0011813Dwarf FortressDwarf Mode -- Interface, Announcementspublic2021-10-05 06:392021-10-25 01:01
Bumber 
 
normalminoralways
newopen 
0.47.05 
 
0011813: '&' in nickname messes with announcement text
It looks like the announcement and report code uses '&' as an escape sequence. Putting "&r" in a dwarf's nickname or profession will split the announcement at that point and continue the rest two lines down. In other combinations, the '&' will display, but the next character in the string will be ignored.

'&' in user text needs to be sanitized to "&&" at some point before ending up in an announcement.
No tags attached.
Issue History
2021-10-05 06:39BumberNew Issue
2021-10-25 00:53BumberNote Added: 0041165
2021-10-25 01:01BumberNote Added: 0041166
2021-10-25 22:40BumberNote Edited: 0041166bug_revision_view_page.php?bugnote_id=0041166#r16755

Notes
(0041165)
Bumber   
2021-10-25 00:53   
There's also an issue in the related code where use of enough ampersands will cause the line to be cut at the wrong index, deleting text. I set custom professions on my sparring dwarves as "&&aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&" and "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&".

gamelog.txt shows:
"The &&aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa& strikes at the &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& but the shot is blocked!"

Sparring report shows:
"The &aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
&&&&&&&&&&&&&&&&&&&but the shot is blocked!"
(0041166)
Bumber   
2021-10-25 01:01   
(edited on: 2021-10-25 22:40)
(There's also a hypothetical crash that could occur if the index to cut the line at underflows as a result of the above, but you'd need 71+ consecutive characters without a space on the smallest grid size of 80.)