summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2023-02-12 23:00:00 +0800
committerMatt Johnston <matt@ucc.asn.au>2023-02-12 23:00:00 +0800
commit3292b8c6f1e5fcc405fa0f7a20e90a60f74037b2 (patch)
tree4c4638942292c64addf32096bc6cf2b87b2fd514
parenta113381c12a2da3c9b7bd594f47a1b2657bdfdf2 (diff)
downloaddropbear-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.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/svr-main.c b/svr-main.c
index 9234361..b923e3c 100644
--- a/svr-main.c
+++ b/svr-main.c
@@ -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);
}