View Issue Details

IDProjectCategoryView StatusLast Update
0000800LDMud 3.6Generalpublic2022-01-09 20:32
Reporterclutch Assigned ToGnomi  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
PlatformLinuxOSCentOSOS Version5.7
Fixed in Version3.6.5 
Summary0000800: (s)printf truncates when using a 0 in the string
DescriptionThis is similar to problem 472. When inserting a 0 into a string using sprintf("%c",0) causes problems later using (s)printf.

Steps To Reproducelpc printf("Does not print after %-=30s, really!",sprintf("asd%casd",1>0?0:'s'))
Additional InformationWe are running LD 3.5 pulled from the latest github.
Tagssprintf

Activities

zesstra

2012-01-08 15:55

administrator   ~0002097

Interestingly the error does only happen in column mode.

zesstra

2012-01-09 23:12

administrator   ~0002098

Additional information/examples:

# printf("asd%casd",0) -> prints "asdasd"
-> works
# sprintf("asd%casd",0) -> returns "asdasd"
-> works
# string str=sprintf("asd%casd",0);printf(str); -> prints "asd"
-> fails

# sprintf("Does not print after %20s, really!",sprintf("asd%casd",0))
-> works
# sprintf("Does not print after %=20s, really!",sprintf("asd%casd",0))
-> fails

At least for the last two: column mode (add_column()) seems to use \0 as termination char for columns.

zesstra

2012-01-09 23:18

administrator   ~0002099

Last edited: 2012-01-10 08:32

As Paradox@Dune just noted:
# string str=sprintf("asd%casd",0);printf("%s",str); -> prints "asdasd"
-> works.
So the format string should not contain \0, the string argument can, unless in column mode.
One error in column mode and one error somewhere else.

Issue History

Date Modified Username Field Change
2012-01-08 01:17 clutch New Issue
2012-01-08 15:55 zesstra Note Added: 0002097
2012-01-08 15:55 zesstra Assigned To => zesstra
2012-01-08 15:55 zesstra Status new => confirmed
2012-01-08 15:57 zesstra Project LDMud => LDMud 3.5
2012-01-08 15:58 zesstra Category Implementation => Compilation, Installation
2012-01-08 15:58 zesstra Target Version => 3.5.0
2012-01-08 15:59 zesstra Assigned To zesstra =>
2012-01-09 23:12 zesstra Note Added: 0002098
2012-01-09 23:18 zesstra Note Added: 0002099
2012-01-10 08:32 zesstra Note Edited: 0002099
2013-08-18 17:07 zesstra Tag Attached: sprintf
2015-04-29 22:03 zesstra Project LDMud 3.5 => LDMud 3.6
2015-04-29 22:03 zesstra Category Compilation, Installation => General
2021-04-19 11:38 Gnomi Assigned To => Gnomi
2021-04-19 11:38 Gnomi Status confirmed => assigned
2022-01-09 20:32 Gnomi Status assigned => resolved
2022-01-09 20:32 Gnomi Resolution open => fixed
2022-01-09 20:32 Gnomi Fixed in Version => 3.6.5