libnitrokey
libnitrokey copied to clipboard
Return of address of stack memory associated with local variable
https://github.com/Nitrokey/libnitrokey/blob/d22a0d28d29429e4d04765ed6e43515cfcdfd9a8/libnitrokey/LibraryException.h#L49-L54
This code trigger -Wreturn-stack-address since this is not a known at compile time string, and thus the content of the string will be use after free by the caller. Ideally if the exception would just return a string for each implementation, there will be no issue.
I think that if the string msg is stored (like in some other exception classes) as a member then this should be good. But this will certainly break ABI.