1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
Description: Fix ftbfs
Use memcpy() instead of strncpy() to avoid the problem of copying more
than the destination size. And at the same time break a snprintf() into
multiple strcpy(), strcat() and strncat().
Forwarded: no
---
--- ploop-1.15.orig/lib/balloon.c
+++ ploop-1.15/lib/balloon.c
@@ -1172,8 +1172,10 @@ static void defrag_pidfile(const char *d
{
char *p = strrchr(dev, '/');
- snprintf(out, size, PLOOP_LOCK_DIR "/%s.defrag.pid",
- p ? ++p : dev);
+ strcpy(out, PLOOP_LOCK_DIR);
+ strcat(out, "/");
+ strncat(out, p ? ++p : dev, size - strlen(out) - 1);
+ strncat(out, ".defrag.pid", size - strlen(out) - 1);
}
static void defrag_complete(const char *dev)
--- ploop-1.15.orig/lib/xml.c
+++ ploop-1.15/lib/xml.c
@@ -278,7 +278,7 @@ void get_basedir(const char *fname, char
{
char *p;
- strncpy(out, fname, len);
+ memcpy(out, fname, len);
p = strrchr(out, '/');
if (p != NULL)
|