Browse Source

Fix memory allocation for test data.

Previously it seems to have worked by accident (there was not enough
space for the end NULL byte).
Georgi Chorbadzhiyski 9 years ago
parent
commit
0344f230b9
1 changed files with 1 additions and 1 deletions
  1. 1
    1
      videohubctrl.c

+ 1
- 1
videohubctrl.c View File

204
 				f = fopen(optarg, "r");
204
 				f = fopen(optarg, "r");
205
 				if (!f)
205
 				if (!f)
206
 					die("Can't open %s: %s", optarg, strerror(errno));
206
 					die("Can't open %s: %s", optarg, strerror(errno));
207
-				test_data = xzalloc(st.st_size);
207
+				test_data = xzalloc(st.st_size + 1);
208
 				if (fread(test_data, st.st_size, 1, f) < 1)
208
 				if (fread(test_data, st.st_size, 1, f) < 1)
209
 					die("Can't read from %s: %s", optarg, strerror(errno));
209
 					die("Can't read from %s: %s", optarg, strerror(errno));
210
 				fclose(f);
210
 				fclose(f);

Loading…
Cancel
Save