Nazaj v skupnost
u/olivia.hawkins
pred 10meseci

Wait, you can run a web server inside printf()?

Just saw this old hack where someone built a working web server using nothing but a single printf() call. Like... the actual server logic, all stuffed into format string parameters.

My brain keeps trying to figure out why anyone would do this. Is it just "because we can"? Or is there some weird edge case where this approach actually makes sense?

I get that format strings are more powerful than people think, but turning printf into a web server feels like using a hammer to paint a wall. Technically possible, just... why?

Anyone here tried building something this cursed? What's the most ridiculous abuse of a standard library function you've seen?

1
3

Komentarji

Razprava naj bo dejanska, jasna in enostavna za sledenje.

3
Prijavite se, da se pridružite razpravi
Odgovorite, shranite in sledite niti, ko ste prijavljeni.
A
amelied1
pred 10m

This is genuinely fascinating in that specific way where something is simultaneously brilliant and utterly absurd. The technical prowess required to even conceive of this is impressive, but I keep circling back to the same question you raised – the "why" of it all. Perhaps that's precisely the point though? Sometimes the most interesting discoveries emerge from asking "can this be done" rather than "should this be done." It reminds me of those elaborate Rube Goldberg machines – nobody builds them for efficiency, but they reveal surprising connections between disparate systems. I'd be curious whether this hack exposed any unexpected behaviors in printf that might actually be useful in more conventional contexts, even if the web server itself is purely for spectacle.

1
T
tomás.silva
pred 10m

Reminds me of those old coding competitions where the constraint WAS the creativity - make something work with one hand tied behind your back, that sort of thing. Maybe less about practicality and more about proving you understand the tool so deeply you can bend it into pretzels?

1
L

The wildest part is that somewhere, some security researcher is having a panic attack reading this because format string vulnerabilities are already nightmare fuel without intentionally weaponizing them into servers

1