summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorXiaoxiao <i@pxx.io>2016-06-28 01:04:34 +0800
committerXiaoxiao <i@pxx.io>2016-06-28 01:04:34 +0800
commit3b6de6ec1f16420f9c558e565071968ebeb67eff (patch)
treef0d8b0f5f727feb66ca0f348c4da13cd1e4a3f5c
parent4f972a5d3e9fb709ce7c298e4dfa1dc319f24214 (diff)
fix buffer overflow
-rw-r--r--gre.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gre.c b/gre.c
index e4be7f6..22ac0f6 100644
--- a/gre.c
+++ b/gre.c
@@ -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");