File hdjmod_fix_buffer_overrun_in_device_name_handling.patch of Package hdjmod
From: Matthias Bach <marix@marix.org>
Date: 20117-07-01 20:40:00 +0200
Subject: Fix a buffer overrun
Upstream: to be done
The code messed up handling of the offset when calculating the
maximum number of bytes it can copy into a buffer at a certain
offset.
diff -Naru hdjmod-1.28o/device.c hdjmod-1.28/device.c
--- hdjmod-1.28o/device.c 2009-01-27 15:25:50.000000000 +0100
+++ hdjmod-1.28/device.c 2017-07-01 20:39:07.129497940 +0200
@@ -1769,7 +1769,7 @@
memset(shortname,0,sizeof(shortname));
snprintf(shortname,sizeof(shortname)-1,"Hercules ");
strncpy(shortname+strlen(shortname),
- card->shortname,sizeof(shortname)+strlen(shortname)-1);
+ card->shortname,sizeof(shortname)-strlen(shortname)-1);
memset(card->shortname,0,sizeof(card->shortname));
strncpy(card->shortname,shortname,sizeof(card->shortname)-1);
}