[GH-ISSUE #1181] Integer overflow #736

Closed
opened 2026-10-14 03:21:53 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @loverszhaokai on GitHub (Apr 5, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1181

I think these two cases are integer overflow.

Case 1

File: src/formats.c
Line: 71

void fmt_init(struct fmt_main *format)
{
        ...
        if (!(opt = getenv("OMP_SCALE")))
            opt = cfg_get_param(SECTION_OPTIONS, NULL,
                                "FormatBlockScaleTuneMultiplier");
        if (opt)
            d = atof(opt);
        if ((int)d > 1)
            format->params.max_keys_per_crypt *= (int)d; // line:73
        ...
}

Case 2

File: src/jumbo.c
Line: 341

int setenv(const char *name, const char *val, int overwrite) {
    int len;
    ...
    len = strlen(name)+1+strlen(val)+1; // line:341
    str = mem_alloc_tiny(len, MEM_ALIGN_NONE);
    sprintf(str, "%s=%s", name, val);
    putenv(str);
    return 0;
}
Originally created by @loverszhaokai on GitHub (Apr 5, 2015). Original GitHub issue: https://github.com/openwall/john/issues/1181 I think these two cases are integer overflow. # Case 1 File: [src/formats.c](https://github.com/magnumripper/JohnTheRipper/blob/bleeding-jumbo/src/formats.c) Line: 71 ``` C void fmt_init(struct fmt_main *format) { ... if (!(opt = getenv("OMP_SCALE"))) opt = cfg_get_param(SECTION_OPTIONS, NULL, "FormatBlockScaleTuneMultiplier"); if (opt) d = atof(opt); if ((int)d > 1) format->params.max_keys_per_crypt *= (int)d; // line:73 ... } ``` # Case 2 File: [src/jumbo.c](https://github.com/magnumripper/JohnTheRipper/blob/bleeding-jumbo/src/jumbo.c) Line: 341 ``` C int setenv(const char *name, const char *val, int overwrite) { int len; ... len = strlen(name)+1+strlen(val)+1; // line:341 str = mem_alloc_tiny(len, MEM_ALIGN_NONE); sprintf(str, "%s=%s", name, val); putenv(str); return 0; } ```
bsakaguchi 2026-10-14 03:21:53 +07:00
Author
Owner

@magnumripper commented on GitHub (Apr 5, 2015):

Yes, that code is totally experimental and not for end users. Actually it should probably be removed now, or at least defined out when not needed.

<!-- gh-comment-id:89770124 --> @magnumripper commented on GitHub (Apr 5, 2015): Yes, that code is totally experimental and not for end users. Actually it should probably be removed now, or at least defined out when not needed.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openwall/john#736
No description provided.