beejjorgensen/bgc

40.11 a note about sscanf

Closed this issue · 1 comments

There is a footgun about sscanf that has been mediatised on HN recently.
Basically sscanf will call strlen so the complexity is linear in the string length. If you use this for a parser and repeatedly call it then you have quadratic complexity.
I'm not sure how it should be integrated, but i feel a mention here might be helpful
Here are the references to the mention of the problems
https://www.mattkeeter.com/blog/2021-03-01-happen/
https://news.ycombinator.com/item?id=26302744
https://nee.lv/2021/02/28/How-I-cut-GTA-Online-loading-times-by-70/

I love that story. Added a section to the sscanf man page. Thanks!