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,7 +204,7 @@ static void parse_options(struct videohub_data *data, int argc, char **argv) {
204 204
 				f = fopen(optarg, "r");
205 205
 				if (!f)
206 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 208
 				if (fread(test_data, st.st_size, 1, f) < 1)
209 209
 					die("Can't read from %s: %s", optarg, strerror(errno));
210 210
 				fclose(f);

Loading…
Cancel
Save