diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2009-01-30 11:06:26 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2009-01-30 11:06:26 +0000 |
commit | 7919d3bafefb7211f5d0cc0b04ffc91e176ca5d5 (patch) | |
tree | 3f7c4ae2c4110ffd3e34a267f1952e07fbb6d3c7 /app/xwud/xwud.c | |
parent | c9c949b92c06c9881051618d64fdccc0ea3ab106 (diff) |
Add more input checks. From "nobody@example.com" on bugs@.
Diffstat (limited to 'app/xwud/xwud.c')
-rw-r--r-- | app/xwud/xwud.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/app/xwud/xwud.c b/app/xwud/xwud.c index 1475f064a..3e1e69336 100644 --- a/app/xwud/xwud.c +++ b/app/xwud/xwud.c @@ -274,6 +274,8 @@ main(int argc, char *argv[]) /* alloc window name */ win_name_size = (header.header_size - SIZEOF(XWDheader)); + if (win_name_size < 1) + Error("win_name_size"); if((win_name = malloc((unsigned) win_name_size + 6)) == NULL) Error("Can't malloc window name storage."); strcpy(win_name, "xwud: "); @@ -281,6 +283,7 @@ main(int argc, char *argv[]) /* read in window name */ if(!Read(win_name + 6, sizeof(char), win_name_size, in_file)) Error("Unable to read window name from dump file."); + (win_name + 6)[win_name_size - 1] = 0; if (dump_header) { DumpHeader(&header, win_name); |