From cdad7fcd8062a1e3edcf4a0b4bf969e6c8b318d4 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Mon, 8 Mar 2010 09:24:21 +0000 Subject: [PATCH] Prevented potential memory fault with burn_set_signal_handling() --- cdrskin/cdrskin_timestamp.h | 2 +- libburn/init.c | 3 ++- libburn/libburn.h | 6 ++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index 68d1db7..cce0cb8 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2010.03.07.081704" +#define Cdrskin_timestamP "2010.03.08.092608" diff --git a/libburn/init.c b/libburn/init.c index a99acb4..904f68f 100644 --- a/libburn/init.c +++ b/libburn/init.c @@ -490,7 +490,8 @@ void burn_set_signal_handling(void *handle, burn_abort_handler_t handler, } strcpy(abort_message_prefix, "libburn : "); - if(handle != NULL) + abort_message_prefix[0] = 0; + if(handle != NULL && handler == burn_builtin_abort_handler) strncpy(abort_message_prefix, (char *) handle, sizeof(abort_message_prefix)-1); abort_message_prefix[sizeof(abort_message_prefix)-1] = 0; diff --git a/libburn/libburn.h b/libburn/libburn.h index 7615804..e0c04d1 100644 --- a/libburn/libburn.h +++ b/libburn/libburn.h @@ -2802,8 +2802,10 @@ typedef int (*burn_abort_handler_t)(void *handle, int signum, int flag); Depending on mode it may cancel all drive operations, wait for all drives to become idle, exit(1). It may also prepare function burn_drive_get_status() for waiting and performing exit(1). - If text is not NULL then it is used as prefix for pacifier messages of - burn_abort_pacifier(). + If parameter handle may be NULL or a text that shall be used as prefix for + pacifier messages of burn_abort_pacifier(). Other than with an application + provided handler, the prefix char array does not have to be kept existing + until the eventual signal event. Before version 0.7.8 only action 0 was available. I.e. the built-in handler waited for the drives to become idle and then performed exit(1) directly. But FreeBSD 8.0 sometimes pauses the other threads until the signal handler