Fix stringop-truncation error 56/232756/1
authorSlava Barinov <v.barinov@samsung.com>
Thu, 7 May 2020 10:13:52 +0000 (13:13 +0300)
committerSlava Barinov <v.barinov@samsung.com>
Thu, 7 May 2020 10:13:52 +0000 (13:13 +0300)
src/statvfs.c:121:4: error: 'strncpy' specified bound 64 equals destination size [-Werror=stringop-truncation]

Change-Id: I328d339e73aeaff2c34db5531b0a3a30ece8f0ed
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
src/statvfs.c

index 976e1d0..e7e9e56 100644 (file)
@@ -118,7 +118,7 @@ static int config_parse(const char *file_name, int cb(struct parse_result *resul
                        }
 
                        *end = '\0';
-                       strncpy(section, start + 1, sizeof(section));
+                       strncpy(section, start + 1, sizeof(section) - 1);
                        section[MAX_SECTION-1] = '\0';
                } else if (*start) {
                        /* parse name & value */