Closed alessio closed 11 years ago
The complete patch follows:
--- phasex.orig/src/alsa_seq.c
+++ phasex/src/alsa_seq.c
@@ -65,7 +65,7 @@ alsa_error_handler(const char *file, int
{
PHASEX_ERROR("Unhandled ALSA error %d in function %s from file %s line %d:\n",
err, func, file, line);
- PHASEX_ERROR(fmt);
+ PHASEX_ERROR("%s", fmt);
}
--- phasex.orig/src/debug.c
+++ phasex/src/debug.c
@@ -92,7 +92,7 @@ phasex_debug_thread(void *UNUSED(arg))
usleep(16000 >> PHASEX_CPU_POWER);
while (main_debug_queue.read_index !=
g_atomic_int_get(& (main_debug_queue.write_index))) {
- fprintf(stderr, (char *)(main_debug_queue.msgs
+ fprintf(stderr, "%s", (char *)(main_debug_queue.msgs
[main_debug_queue.read_index].msg));
main_debug_queue.read_index =
(main_debug_queue.read_index + 1) & DEBUG_BUFFER_MASK;
--- phasex.orig/src/phasex.c
+++ phasex/src/phasex.c
@@ -391,7 +391,7 @@ phasex_shutdown(const char *msg)
{
/* output message from caller */
if (msg != NULL) {
- fprintf(stderr, msg);
+ fprintf(stderr, "%s", msg);
}
/* keep current midi port settings. */
Thank you! This has been applied as a hot-fix to the v0.14.97 branch. To avoid this issue in the future, '-Werror=format-security' has been added for debug builds.
Hi,
on Debian the phasex's latest release fails to compile as we use to enable some hardened flags during the build. A patch for src/alsa_seq.c follows:
Thanks for considering.
PS: I had just a quick look at the code so there might be many more lines to be fixed