diff options
author | Matt Johnston <matt@ucc.asn.au> | 2023-02-12 23:00:00 +0800 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2023-02-12 23:00:00 +0800 |
commit | 3292b8c6f1e5fcc405fa0f7a20e90a60f74037b2 (patch) | |
tree | 4c4638942292c64addf32096bc6cf2b87b2fd514 | |
parent | a113381c12a2da3c9b7bd594f47a1b2657bdfdf2 (diff) | |
download | dropbear-3292b8c6f1e5fcc405fa0f7a20e90a60f74037b2.tar.gz |
Use write() rather than fprintf() in segv handler
fprintf isn't guaranteed safe (though hasn't had any problems reported).
-rw-r--r-- | svr-main.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -420,8 +420,12 @@ static void sigchld_handler(int UNUSED(unused)) { /* catch any segvs */ static void sigsegv_handler(int UNUSED(unused)) { - fprintf(stderr, "Aiee, segfault! You should probably report " - "this as a bug to the developer\n"); + int i; + const char *msg = "Aiee, segfault! You should probably report " + "this as a bug to the developer\n"; + i = write(STDERR_FILENO, msg, strlen(msg)); + /* ignore short writes */ + (void)i; _exit(EXIT_FAILURE); } |