How did printf end up here in the first place? Decades of feature additions, or were these features a part of an early spec?
Best of show – abuse of libc
11–20 of 84 posts
Re: Best of show – abuse of libc
#12> Format specifiers can take extra “arguments”. - "%hhn": store the number of bytes written mod 256 to the char pointer ... Oh boy. I'll put that down for my "thing I don't think I wanted to know" of the day.
There is some innocent beauty in the twistedness of printf - especially with GNU extensions.
Re: Best of show – abuse of libc
#13Earlier quoted context omitted.
There is some innocent beauty in the twistedness of printf - especially with GNU extensions.
GNU's printf specifier language is Turing complete, I believe.
Re: Best of show – abuse of libc
#14Up next: a C compiler that compiles to printf statements :-P
https://github.com/HexHive/printbf well this is a brainfuck interpreter inside printf. I’m pretty sure there are plenty of c-to-bf transpilers.
Re: Best of show – abuse of libc
#15> Format specifiers can take extra “arguments”. - "%hhn": store the number of bytes written mod 256 to the char pointer ... Oh boy. I'll put that down for my "thing I don't think I wanted to know" of the day.
There is some innocent beauty in the twistedness of printf - especially with GNU extensions.
Re: Best of show – abuse of libc
#16Up next: a C compiler that compiles to printf statements :-P
https://github.com/HexHive/printbf well this is a brainfuck interpreter inside printf. I’m pretty sure there are plenty of c-to-bf transpilers.
Re: Best of show – abuse of libc
#17Earlier quoted context omitted.
There is some innocent beauty in the twistedness of printf - especially with GNU extensions.
So I can port doom to gnu printf?
[0] Mentioned (but not directly linked) by TFA:
https://www.usenix.org/conference/usenixsecurity15/technical...
Re: Best of show – abuse of libc
#18How did printf end up here in the first place? Decades of feature additions, or were these features a part of an early spec?
Looking at old source code, the earliest implementation I found is 4.3BSD Tahoe (1988). See https://www.tuhs.org/cgi-bin/utree.pl?file=4.3BSD-Tahoe/usr/... Second oldest I found was Tenth Edition [Research] Unix (1989). See ocvt_n at https://www.tuhs.org/cgi-bin/utree.pl?file=V10/libc/stdio/vf... I couldn't find support in earlier implementations archived on that site.
Re: Best of show – abuse of libc
#19awesome. I didn't know about that printf hack....time for some fun experiments
Re: Best of show – abuse of libc
#20General thread here: https://news.ycombinator.com/item?id=25651942