Re:Systemd needs official documentation on best practices
by marcosdumay on Friday November 08, 2019 @03:53PM
(#21486610)
The GP is probably more focused on textual logs.
But yes, C is very weak on converting data from one encoding into another. You end-up always having to write your own encoder/decoder.
You should be able to convert between binary and base64 on memory more easily than during IO, and for encryption keys the buffers all have known size limits. As a rule sscanf will add security vulnerabilities to your code, so one should better avoid it if you do not trust your inputs.
But yes, C is very weak on converting data from one encoding into another. You end-up always having to write your own encoder/decoder.
You should be able to convert between binary and base64 on memory more easily than during IO, and for encryption keys the buffers all have known size limits. As a rule sscanf will add security vulnerabilities to your code, so one should better avoid it if you do not trust your inputs.