diff options
author | Đoàn Trần Công Danh <congdanhqx@gmail.com> | 2020-04-21 06:54:36 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-04-22 14:01:03 -0700 |
commit | 391999744771002cb5feded004879f36534b9b14 (patch) | |
tree | aa798672f7de55ac0c582d09fffcaba5ede0bec2 /mailinfo.c | |
parent | 2a2ff6039606b93ad08d8d377804ddcd0bc41312 (diff) | |
download | git-391999744771002cb5feded004879f36534b9b14.tar.gz |
mailinfo: disallow NUL character in mail's header
Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'mailinfo.c')
-rw-r--r-- | mailinfo.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/mailinfo.c b/mailinfo.c index 0e9911df6d..5681d9130d 100644 --- a/mailinfo.c +++ b/mailinfo.c @@ -1138,6 +1138,11 @@ static void handle_info(struct mailinfo *mi) else continue; + if (memchr(hdr->buf, '\0', hdr->len)) { + error("a NUL byte in '%s' is not allowed.", header[i]); + mi->input_error = -1; + } + if (!strcmp(header[i], "Subject")) { if (!mi->keep_subject) { cleanup_subject(mi, hdr); |