Fixing a compiler warning and a tiny coding mistake
authorMuhammad Usama <m.usama@gmail.com>
Mon, 30 Sep 2019 09:55:06 +0000 (14:55 +0500)
committerMuhammad Usama <m.usama@gmail.com>
Mon, 30 Sep 2019 09:55:06 +0000 (14:55 +0500)
src/tools/pcp/pcp_frontend_client.c
src/utils/psprintf.c

index b9f7bc578e226c04e657f061600b18bebc03181c..fa815572552531dca7f5a0c36cb01668fb165889 100644 (file)
@@ -873,7 +873,7 @@ format_titles(const char **titles, const char **types, int ntitles)
 
                snprintf(buf, sizeof(buf), "%%-%ds : %%%%%s", maxlen, types[i]);
                snprintf(buf2, sizeof(buf2), buf, titles[i], types[i]);
-               strncat(formatbuf, buf2, sizeof(buf2));
+               strncat(formatbuf, buf2, sizeof(formatbuf) - strlen(formatbuf) - 2);
                strcat(formatbuf, "\n");
        }
        return formatbuf;
index 7dba828e4a0a49baf6c8141904490cb2f3792e4d..7eba81d4b7b4cb9a6c134a6ea062bed51198e053 100644 (file)
@@ -26,7 +26,7 @@
 #include "utils/memutils.h"
 
 #else
-
+#include <string.h>
 #include "utils/fe_ports.h"
 
 /* It's possible we could use a different value for this in frontend code */