logoalt Hacker News

Joker_vD • today at 3:27 PM • 1 reply • view on HN

You know that GNU libc to this day essentially calls strlen() on every call to sscanf(), which is pretty much the same issue? And that this behaviour, present in many other implementations of standard C library (including Microsoft's), was responsible for e.g. slow JSON parsing in some very popular online games [0]? Does that mean glibc is still not production-ready?

[0] https://news.ycombinator.com/item?id=26296339


Replies

dleslie • today at 3:49 PM

sscanf is quadratic in the worst case, and has been flagged along with the bulk of the rest of the libc string support as being hazardous or potentially harmful. Its continued existence is for compatibility, but new projects should not use it.

➕ show 1 reply