Quellcode durchsuchen

quorumtool: Assert copied string length

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Jan Friesse vor 6 Jahren
Ursprung
Commit
56ee850301
1 geänderte Dateien mit 1 neuen und 0 gelöschten Zeilen
  1. 1 0
      tools/corosync-quorumtool.c

+ 1 - 0
tools/corosync-quorumtool.c

@@ -334,6 +334,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);
 	}
 	}