CGRP_RULE_MAXLINE const, which is used as a length for buffer for
unparsed cgroup rules strings, doesn't include length of options
field (CG_OPTIONS_MAX). Therefore buffer length is not enough
to store all rule fields.
Commit is aimed to include CG_OPTIONS_MAX in CGRP_RULE_MAXLINE
to avoid potential problems with rules parsing.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
[Kamalesh introduced tabs to align with macro continuation]
Signed-off-by: Mikhail Dmitrichenko <m.dmitrichenko222@gmail.com>
Acked-by: Tom Hromatka <tom.hromatka@oracle.com>
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
(cherry picked from commit
88fc455b8d0df20910ee2f8e90eb90a4752bd986)
#define CGRP_RULE_MAXKEY (LOGIN_NAME_MAX + FILENAME_MAX + 1)
/* Maximum length of a line in the daemon config file */
-#define CGRP_RULE_MAXLINE (FILENAME_MAX + CGRP_RULE_MAXKEY + CG_CONTROLLER_MAX + 3)
+#define CGRP_RULE_MAXLINE (FILENAME_MAX + CGRP_RULE_MAXKEY + CG_CONTROLLER_MAX + \
+ CG_OPTIONS_MAX + 4)
#define CGRP_FILE_PREFIX "cgroup"