--- a/src/common/rclconfig.cpp
+++ b/src/common/rclconfig.cpp
@@ -23,6 +23,7 @@
#include <stdio.h>
#include <errno.h>
#include <langinfo.h>
+#include <limits.h>
#include <set>
#include <algorithm>
@@ -959,9 +960,10 @@
bool RclConfig::initUserConfig()
{
// Explanatory text
- char blurb[sizeof(blurb0)+1025];
+ const int bs = sizeof(blurb0)+PATH_MAX+1;
+ char blurb[bs];
string exdir = path_cat(m_datadir, "examples");
- sprintf(blurb, blurb0, exdir.c_str());
+ snprintf(blurb, bs, blurb0, exdir.c_str());
// Use protective 700 mode to create the top configuration
// directory: documents can be reconstructed from index data.