View Issue Details

IDProjectCategoryView StatusLast Update
0000665LDMud 3.6Efunspublic2022-01-09 20:34
Reportergarapol Assigned ToGnomi  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.3.718 
Fixed in Version3.6.5 
Summary0000665: sscanf and %% don't like each other
Descriptionsscanf(str, fmt, junk, junk2)
does not work correctly for some of the following:

      str | fmt | result | should result
----------+------------+--------------+---------------------
te%st | %s%%%s | (te, 0) | (te, st)
%%s | %s%%%s | (%, 0) | (%, s) oder (0, %s)
s%%%%%t%% | %s%%t | s%%%% | 0
s%%%%% | %s%% | s | s%%%%
s% | %s%% | s | s (Ok)
%%s | %%%s | %s | %s (Ok)
%s | %%%s | s | s (Ok)

BTW: In efun.c the sscanf-code have some gotos. ;-)


Garapol Leckerlin (@Avalon)
Additional InformationI don't know wether other format strings may have bugs, too. I only saw these for %%.
TagsNo tags attached.

Activities

Gnomi

2021-04-08 17:37

manager   ~0002572

I don't agree with the 3rd and 4th case:

sscanf("s%%%%%t%%", ""%s%%t", x) should yield "s%%%" instead of 0.
sscanf("s%%%%%", "%s%%", x) can yield "s".

sscanf() is never required the match the whole input string. Therefore "s%%%" is valid result in the first case, because for %s it is only required that the following characters match as well (%t), which they do. In the second case "s" is also a valid result, because the following characters (in this case "%") match.

Issue History

Date Modified Username Field Change
2009-06-18 15:12 garapol New Issue
2021-04-08 17:37 Gnomi Note Added: 0002572
2021-04-08 17:37 Gnomi Assigned To => Gnomi
2021-04-08 17:37 Gnomi Status new => assigned
2022-01-09 20:34 Gnomi Project LDMud => LDMud 3.6
2022-01-09 20:34 Gnomi Status assigned => resolved
2022-01-09 20:34 Gnomi Resolution open => fixed
2022-01-09 20:34 Gnomi Fixed in Version => 3.6.5