diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2017-11-17 18:54:19 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2017-11-17 18:54:19 +0100 |
| commit | 00f6ff581c6a4296baf3271e9114cc3a18da93e6 (patch) | |
| tree | 0cf42e925471d4a60b2bfdbcbb31a260f849206d | |
| parent | 2950adb95c95c76906018f1de813a3270eb4a94f (diff) | |
pkg/email: truncate garbage after patches
| -rw-r--r-- | pkg/email/parser_test.go | 6 | ||||
| -rw-r--r-- | pkg/email/patch.go | 3 | ||||
| -rw-r--r-- | pkg/email/patch_test.go | 62 |
3 files changed, 67 insertions, 4 deletions
diff --git a/pkg/email/parser_test.go b/pkg/email/parser_test.go index 9c0a1ceec..ab5fad631 100644 --- a/pkg/email/parser_test.go +++ b/pkg/email/parser_test.go @@ -340,7 +340,7 @@ index 3d85747bd86e..a257b872a53d 100644 return -EINVAL; - if (!filename) - return -EINVAL; - + error = vfs_statx(dfd, filename, flags, &stat, mask); if (error) @@ -398,7 +398,7 @@ index 3d85747bd86e..a257b872a53d 100644 return -EINVAL; - if (!filename) - return -EINVAL; - + error = vfs_statx(dfd, filename, flags, &stat, mask); if (error) `, @@ -410,7 +410,7 @@ index 3d85747bd86e..a257b872a53d 100644 return -EINVAL; - if (!filename) - return -EINVAL; - + error = vfs_statx(dfd, filename, flags, &stat, mask); if (error) `, diff --git a/pkg/email/patch.go b/pkg/email/patch.go index 46a31a05d..d91a6a020 100644 --- a/pkg/email/patch.go +++ b/pkg/email/patch.go @@ -23,7 +23,8 @@ func ParsePatch(text string) (title string, diff string, err error) { } } if parsingDiff { - if ln == "--" || ln == "-- " { + if ln == "" || ln == "--" || ln == "-- " || ln[0] == '>' || + ln[0] >= 'A' && ln[0] <= 'Z' { break } diff += ln + "\n" diff --git a/pkg/email/patch_test.go b/pkg/email/patch_test.go index 42990effd..b10211ff0 100644 --- a/pkg/email/patch_test.go +++ b/pkg/email/patch_test.go @@ -245,6 +245,8 @@ Subject: [Patch net] kcm: fix a null pointer dereference in kcm_sendmsg() + spinlock_t cancel_lock; bool might_cancel; }; + +On Fri, Nov 17, 2017 at 3:46 PM, syzbot wrote: `, title: "kcm: fix a null pointer dereference in kcm_sendmsg()", diff: `--- a/fs/timerfd.c @@ -272,6 +274,7 @@ Subject: Re: [PATCH v3] net/irda: fix lockdep annotation + spinlock_t cancel_lock; bool might_cancel; }; +> Does this help? `, title: "net/irda: fix lockdep annotation", diff: `--- a/fs/timerfd.c @@ -303,4 +306,63 @@ index 0000000..a1a0499 +package dash `, }, + { + text: `Subject: multi-file patch + +diff --git a/init/main.c b/init/main.c +index 0ee9c6866ada..ed01296f7b23 100644 +--- a/init/main.c ++++ b/init/main.c +@@ -706,6 +706,8 @@ asmlinkage __visible void __init start_kernel(void) + efi_free_boot_services(); + } + ++ BUG(); ++ + /* Do the rest non-__init'ed, we're now alive */ + rest_init(); + } +diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c +index 6f319fb81718..76a8d5aeed4b 100644 +--- a/mm/kasan/kasan.c ++++ b/mm/kasan/kasan.c +@@ -42,7 +42,7 @@ + + void kasan_enable_current(void) + { +- current->kasan_depth++; ++ current->kasan_depth--; + } + + void kasan_disable_current(void) + +> Does this help? +`, + title: "multi-file patch", + diff: `--- a/init/main.c ++++ b/init/main.c +@@ -706,6 +706,8 @@ asmlinkage __visible void __init start_kernel(void) + efi_free_boot_services(); + } + ++ BUG(); ++ + /* Do the rest non-__init'ed, we're now alive */ + rest_init(); + } +diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c +index 6f319fb81718..76a8d5aeed4b 100644 +--- a/mm/kasan/kasan.c ++++ b/mm/kasan/kasan.c +@@ -42,7 +42,7 @@ + + void kasan_enable_current(void) + { +- current->kasan_depth++; ++ current->kasan_depth--; + } + + void kasan_disable_current(void) +`, + }, } |
