[PATCH 2/5] coroparse: Ensure that config items fits into cmap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Jan Friesse <jfriesse@xxxxxxxxxx>
---
 exec/coroparse.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/exec/coroparse.c b/exec/coroparse.c
index 0015861..af4072d 100644
--- a/exec/coroparse.c
+++ b/exec/coroparse.c
@@ -330,6 +330,10 @@ static int parse_section(FILE *fp,
 			loc--;
 			*loc = '\0';
 
+			if (strlen(path) + strlen(section) + 1 >= ICMAP_KEYNAME_MAXLEN) {
+				*error_string = "parser error: Start of section makes total cmap path too long";
+				return -1;
+			}
 			strcpy(new_keyname, path);
 			if (strcmp(path, "") != 0) {
 				strcat(new_keyname, ".");
@@ -355,6 +359,10 @@ static int parse_section(FILE *fp,
 			key = remove_whitespace(line, 1);
 			value = remove_whitespace(loc, 0);
 
+			if (strlen(path) + strlen(key) + 1 >= ICMAP_KEYNAME_MAXLEN) {
+				*error_string = "parser error: New key makes total cmap path too long";
+				return -1;
+			}
 			strcpy(new_keyname, path);
 			if (strcmp(path, "") != 0) {
 				strcat(new_keyname, ".");
-- 
1.7.1

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss




[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux