summaryrefslogtreecommitdiff
path: root/test/stringcomp.c
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2012-05-29 16:15:07 +0100
committerDaniel Stone <daniel@fooishbar.org>2012-05-29 16:19:24 +0100
commitc87468e926f75fef29e5f6c997d8baa28d8bc8a9 (patch)
tree101b539ad8a4d683a1c4d49bbf0ee5f633486ffe /test/stringcomp.c
parenta3ae0e84e4bf86012d690e1a2cf94f398695dbf0 (diff)
downloadxorg-lib-libxkbcommon-c87468e926f75fef29e5f6c997d8baa28d8bc8a9.tar.gz
stringcomp: NULL-terminate string
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Diffstat (limited to 'test/stringcomp.c')
-rw-r--r--test/stringcomp.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/test/stringcomp.c b/test/stringcomp.c
index d05c7d4..a079346 100644
--- a/test/stringcomp.c
+++ b/test/stringcomp.c
@@ -55,7 +55,7 @@ int main(int argc, char *argv[])
fd = open(path, O_RDONLY);
assert(fd >= 0);
assert(fstat(fd, &info) == 0);
- as_string = malloc(info.st_size);
+ as_string = malloc(info.st_size + 1);
assert(as_string);
remaining = info.st_size;
@@ -66,8 +66,7 @@ int main(int argc, char *argv[])
}
assert(remaining == 0);
-
- fprintf(stderr, "trying to parse this:\n%s\n", as_string);
+ as_string[info.st_size] = '\0';
keymap = xkb_map_new_from_string(ctx, as_string,
XKB_KEYMAP_FORMAT_TEXT_V1, 0);