diff options
author | Xiaoxiao <i@pxx.io> | 2016-06-28 01:04:34 +0800 |
---|---|---|
committer | Xiaoxiao <i@pxx.io> | 2016-06-28 01:04:34 +0800 |
commit | 3b6de6ec1f16420f9c558e565071968ebeb67eff (patch) | |
tree | f0d8b0f5f727feb66ca0f348c4da13cd1e4a3f5c | |
parent | 4f972a5d3e9fb709ce7c298e4dfa1dc319f24214 (diff) |
fix buffer overflow
-rw-r--r-- | gre.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -52,7 +52,7 @@ int main(int argc, char **argv) { fd_set readset; - if (argc != 4) + if (argc != 4) { printf("usage: %s <tun> remote local\n", argv[0]); return EXIT_FAILURE; @@ -180,7 +180,7 @@ static void tun_cb(void) { int n; - n = read(tun, buf + 4, sizeof(buf)); + n = read(tun, buf + 4, sizeof(buf) - 4); if (n < 0) { perror("read"); |