Преглед изворни кода

quorumtool: Assert copied string length

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
(cherry picked from commit 56ee850301ae08213e19a163443a8d0f0b5068aa)
Jan Friesse пре 6 година
родитељ
комит
cab6efee80
1 измењених фајлова са 1 додато и 0 уклоњено
  1. 1 0
      tools/corosync-quorumtool.c

+ 1 - 0
tools/corosync-quorumtool.c

@@ -332,6 +332,7 @@ static const char *node_name(uint32_t nodeid, name_format_t name_format)
 	if ((nodelist_name) &&
 	if ((nodelist_name) &&
 	    (strlen(nodelist_name) > 0)) {
 	    (strlen(nodelist_name) > 0)) {
 		start_addr = 1;
 		start_addr = 1;
+		assert(strlen(nodelist_name) < sizeof(buf));
 		strcpy(buf, nodelist_name);
 		strcpy(buf, nodelist_name);
 		bufptr = strlen(buf);
 		bufptr = strlen(buf);
 	}
 	}