apps/req.c:1197: error: BUFFER_OVERRUN_L3
  Offset: [-1, +oo] Size: 1024.
Showing all 6 steps of the trace


apps/req.c:1160:1: <Offset trace>
1158.   }
1159.   
1160. > static int add_DN_object(X509_NAME *n, char *text, const char *def,
1161.                            char *value, int nid, int n_min, int n_max,
1162.                            unsigned long chtype, int mval)

apps/req.c:1160:1: Array declaration
1158.   }
1159.   
1160. > static int add_DN_object(X509_NAME *n, char *text, const char *def,
1161.                            char *value, int nid, int n_min, int n_max,
1162.                            unsigned long chtype, int mval)

apps/req.c:1196:5: Assignment
1194.       }
1195.   
1196.       i = strlen(buf);
            ^
1197.       if (buf[i - 1] != '\n') {
1198.           BIO_printf(bio_err, "weird input :-(\n");

apps/req.c:1160:1: <Length trace>
1158.   }
1159.   
1160. > static int add_DN_object(X509_NAME *n, char *text, const char *def,
1161.                            char *value, int nid, int n_min, int n_max,
1162.                            unsigned long chtype, int mval)

apps/req.c:1160:1: Array declaration
1158.   }
1159.   
1160. > static int add_DN_object(X509_NAME *n, char *text, const char *def,
1161.                            char *value, int nid, int n_min, int n_max,
1162.                            unsigned long chtype, int mval)

apps/req.c:1197:9: Array access: Offset: [-1, +oo] Size: 1024
1195.   
1196.       i = strlen(buf);
1197.       if (buf[i - 1] != '\n') {
                ^
1198.           BIO_printf(bio_err, "weird input :-(\n");
1199.           return 0;

static int add_DN_object(X509_NAME *n, char *text, const char *def,
                         char *value, int nid, int n_min, int n_max,
                         unsigned long chtype, int mval)
{
    int i, ret = 0;
    char buf[1024];
 start:
    if (!batch)
        BIO_printf(bio_err, "%s [%s]:", text, def);
    (void)BIO_flush(bio_err);
    if (value != NULL) {
        OPENSSL_strlcpy(buf, value, sizeof buf);
        OPENSSL_strlcat(buf, "\n", sizeof buf);
        BIO_printf(bio_err, "%s\n", value);
    } else {
        buf[0] = '\0';
        if (!batch) {
            if (!fgets(buf, sizeof buf, stdin))
                return 0;
        } else {
            buf[0] = '\n';
            buf[1] = '\0';
        }
    }
    if (buf[0] == '\0')
        return 0;
    if (buf[0] == '\n') {
        if ((def == NULL) || (def[0] == '\0'))
            return 1;
        OPENSSL_strlcpy(buf, def, sizeof buf);
        OPENSSL_strlcat(buf, "\n", sizeof buf);
    } else if ((buf[0] == '.') && (buf[1] == '\n')) {
        return 1;
    }
    i = strlen(buf);
    if (buf[i - 1] != '\n') {
        BIO_printf(bio_err, "weird input :-(\n");
        return 0;
    }
    buf[--i] = '\0';
#ifdef CHARSET_EBCDIC
    ebcdic2ascii(buf, buf, i);
#endif
    if (!req_check_len(i, n_min, n_max)) {
        if (batch || value)
            return 0;
        goto start;
    }
    if (!X509_NAME_add_entry_by_NID(n, nid, chtype,
                                    (unsigned char *)buf, -1, -1, mval))
        goto err;
    ret = 1;
 err:
    return (ret);
}
['static int add_DN_object(X509_NAME *n, char *text, const char *def,\n                         char *value, int nid, int n_min, int n_max,\n                         unsigned long chtype, int mval)\n{\n    int i, ret = 0;\n    char buf[1024];\n start:\n    if (!batch)\n        BIO_printf(bio_err, "%s [%s]:", text, def);\n    (void)BIO_flush(bio_err);\n    if (value != NULL) {\n        OPENSSL_strlcpy(buf, value, sizeof buf);\n        OPENSSL_strlcat(buf, "\\n", sizeof buf);\n        BIO_printf(bio_err, "%s\\n", value);\n    } else {\n        buf[0] = \'\\0\';\n        if (!batch) {\n            if (!fgets(buf, sizeof buf, stdin))\n                return 0;\n        } else {\n            buf[0] = \'\\n\';\n            buf[1] = \'\\0\';\n        }\n    }\n    if (buf[0] == \'\\0\')\n        return 0;\n    if (buf[0] == \'\\n\') {\n        if ((def == NULL) || (def[0] == \'\\0\'))\n            return 1;\n        OPENSSL_strlcpy(buf, def, sizeof buf);\n        OPENSSL_strlcat(buf, "\\n", sizeof buf);\n    } else if ((buf[0] == \'.\') && (buf[1] == \'\\n\')) {\n        return 1;\n    }\n    i = strlen(buf);\n    if (buf[i - 1] != \'\\n\') {\n        BIO_printf(bio_err, "weird input :-(\\n");\n        return 0;\n    }\n    buf[--i] = \'\\0\';\n#ifdef CHARSET_EBCDIC\n    ebcdic2ascii(buf, buf, i);\n#endif\n    if (!req_check_len(i, n_min, n_max)) {\n        if (batch || value)\n            return 0;\n        goto start;\n    }\n    if (!X509_NAME_add_entry_by_NID(n, nid, chtype,\n                                    (unsigned char *)buf, -1, -1, mval))\n        goto err;\n    ret = 1;\n err:\n    return (ret);\n}']