File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -1138,6 +1138,11 @@ static void handle_info(struct mailinfo *mi)
1138
1138
else
1139
1139
continue ;
1140
1140
1141
+ if (memchr (hdr -> buf , '\0' , hdr -> len )) {
1142
+ error ("a NUL byte in '%s' is not allowed." , header [i ]);
1143
+ mi -> input_error = -1 ;
1144
+ }
1145
+
1141
1146
if (!strcmp (header [i ], "Subject" )) {
1142
1147
if (!mi -> keep_subject ) {
1143
1148
cleanup_subject (mi , hdr );
Original file line number Diff line number Diff line change @@ -70,10 +70,13 @@ test_expect_success "NUL in commit message's body" '
70
70
grep "a NUL byte in commit log message not allowed" err
71
71
'
72
72
73
- test_expect_failure " NUL in commit message's header" "
73
+ test_expect_success " NUL in commit message's header" "
74
74
test_when_finished 'git am --abort' &&
75
75
make_mbox_with_nul subject >subject.patch &&
76
- test_must_fail git am subject.patch
76
+ test_must_fail git mailinfo msg patch <subject.patch 2>err &&
77
+ grep \" a NUL byte in 'Subject' is not allowed\" err &&
78
+ test_must_fail git am subject.patch 2>err &&
79
+ grep \" a NUL byte in 'Subject' is not allowed\" err
77
80
"
78
81
79
82
test_done
You can’t perform that action at this time.
0 commit comments