tools/csr: Fix possible buffer overflow

Make sure we don't write past the end of the array.
diff --git a/tools/csr.c b/tools/csr.c
index 2c09189..15ae7c4 100644
--- a/tools/csr.c
+++ b/tools/csr.c
@@ -2756,7 +2756,7 @@
 
 	off++;
 
-	while (1) {
+	while (length <= sizeof(array) - 2) {
 		value = strtol(off, &end, 16);
 		if (value == 0 && off == end)
 			break;