Browse Source

Improve some range checks.

Georgi Chorbadzhiyski 9 years ago
parent
commit
bcab8b796b
2 changed files with 2 additions and 2 deletions
  1. 1
    1
      cmd.c
  2. 1
    1
      videohubctrl.c

+ 1
- 1
cmd.c View File

275
 		case CMD_VIDEO_OUTPUT_ROUTING:
275
 		case CMD_VIDEO_OUTPUT_ROUTING:
276
 			if (valid_slot) {
276
 			if (valid_slot) {
277
 				unsigned int dest_pos = strtoul(slot_data, NULL, 10);
277
 				unsigned int dest_pos = strtoul(slot_data, NULL, 10);
278
-				if (dest_pos < ARRAY_SIZE(data->outputs))
278
+				if (dest_pos < ARRAY_SIZE(data->inputs))
279
 					data->outputs[slot_pos].routed_to = dest_pos;
279
 					data->outputs[slot_pos].routed_to = dest_pos;
280
 			}
280
 			}
281
 			break;
281
 			break;

+ 1
- 1
videohubctrl.c View File

138
 	printf_line(70);
138
 	printf_line(70);
139
 	printf("|  # | x | %-27s | %-27s |\n", "Input name", "Output name");
139
 	printf("|  # | x | %-27s | %-27s |\n", "Input name", "Output name");
140
 	printf_line(70);
140
 	printf_line(70);
141
-	for(i = 0; i < d->device.num_video_inputs; i++) {
141
+	for(i = 0; i < MIN(d->device.num_video_outputs, ARRAY_SIZE(d->outputs)); i++) {
142
 		printf("| %2d | %c | %-27s | %-27s |\n",
142
 		printf("| %2d | %c | %-27s | %-27s |\n",
143
 			i + 1,
143
 			i + 1,
144
 			d->outputs[i].locked ? (d->outputs[i].locked_other ? 'L' : 'O') : ' ',
144
 			d->outputs[i].locked ? (d->outputs[i].locked_other ? 'L' : 'O') : ' ',

Loading…
Cancel
Save