[augeas-devel] [PATCH 2/4] * src/pathx.c (store_error): never append to an uninitialized string

lutter at redhat.com lutter at redhat.com
Wed Jan 12 02:05:16 UTC 2011


From: David Lutterkort <lutter at redhat.com>

---
 src/pathx.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/pathx.c b/src/pathx.c
index 22b5a57..8775be8 100644
--- a/src/pathx.c
+++ b/src/pathx.c
@@ -2054,6 +2054,8 @@ static void store_error(struct pathx *pathx) {
             strcat(pos_str, " in ");
             strncat(pos_str, path, pos);
         } else {
+            /* initialize pos_str explicitly, path might be "" */
+            pos_str[0] = '\0';
             strncpy(pos_str, path, pos);
         }
         strcat(pos_str, "|=|");
-- 
1.7.3.4




More information about the augeas-devel mailing list