]> git.ipfire.org Git - thirdparty/git.git/blobdiff - mailinfo.c
Merge branch 'jk/mailinfo-oob-read-fix'
[thirdparty/git.git] / mailinfo.c
index 931505363cde08b0475f200e9c60fd3c034413b7..968186421623d45011bae29637b2e9cc111abdc7 100644 (file)
@@ -1,7 +1,7 @@
 #include "git-compat-util.h"
 #include "config.h"
 #include "gettext.h"
-#include "hex.h"
+#include "hex-ll.h"
 #include "utf8.h"
 #include "strbuf.h"
 #include "mailinfo.h"
@@ -58,12 +58,12 @@ static void parse_bogus_from(struct mailinfo *mi, const struct strbuf *line)
 
 static const char *unquote_comment(struct strbuf *outbuf, const char *in)
 {
-       int c;
        int take_next_literally = 0;
 
        strbuf_addch(outbuf, '(');
 
-       while ((c = *in++) != 0) {
+       while (*in) {
+               int c = *in++;
                if (take_next_literally == 1) {
                        take_next_literally = 0;
                } else {
@@ -88,10 +88,10 @@ static const char *unquote_comment(struct strbuf *outbuf, const char *in)
 
 static const char *unquote_quoted_string(struct strbuf *outbuf, const char *in)
 {
-       int c;
        int take_next_literally = 0;
 
-       while ((c = *in++) != 0) {
+       while (*in) {
+               int c = *in++;
                if (take_next_literally == 1) {
                        take_next_literally = 0;
                } else {
@@ -1253,6 +1253,8 @@ static int git_mailinfo_config(const char *var, const char *value,
                return 0;
        }
        if (!strcmp(var, "mailinfo.quotedcr")) {
+               if (!value)
+                       return config_error_nonbool(var);
                if (mailinfo_parse_quoted_cr_action(value, &mi->quoted_cr) != 0)
                        return error(_("bad action '%s' for '%s'"), value, var);
                return 0;