Merge pull request #2915 from jplitza/fix-2076
authorPavel Rochnyak <pavel2000@ngs.ru>
Thu, 30 Aug 2018 05:14:38 +0000 (11:14 +0600)
committerGitHub <noreply@github.com>
Thu, 30 Aug 2018 05:14:38 +0000 (11:14 +0600)
nfs: Fix number of fields for NFSv4

src/nfs.c

index e1987f1..481aa79 100644 (file)
--- a/src/nfs.c
+++ b/src/nfs.c
@@ -519,7 +519,8 @@ static int nfs_submit_nfs4_client(const char *instance, char **fields,
 static void nfs_read_linux(FILE *fh, const char *inst) {
   char buffer[1024];
 
-  char *fields[64];
+  // The stats line is prefixed with type and number of fields, thus plus 2
+  char *fields[MAX(NFS4_SERVER_MAX_PROC, NFS4_CLIENT_MAX_PROC) + 2];
   int fields_num = 0;
 
   if (fh == NULL)