Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null Pointer Dereferencing in ae.h、dict.c、async.c、ivykis.h and libevent.h #751

Closed
salmonx opened this issue Jan 18, 2020 · 1 comment

Comments

@salmonx
Copy link

salmonx commented Jan 18, 2020

The following code has null pointers dereferencing, typically causing a crash or exit.

ae.h:111

    e = (redisAeEvents*)malloc(sizeof(*e));  // e may be null
    e->context = ac;
    e->loop = loop;
    e->fd = c->fd;
    e->reading = e->writing = 0;

dict.c:100

    n.table = calloc(realsize,sizeof(dictEntry*)); // n.table may be null
    ...
    for (i = 0; i < ht->size && ht->used > 0; i++) {
        if (ht->table[i] == NULL) continue;
        ....
        he = ht->table[i];
        ...

async.c:757

    if (!ac->c.timeout) {
        ac->c.timeout = calloc(1, sizeof(tv)); //ac->c.timeout  may be null
    }

    if (tv.tv_sec == ac->c.timeout->tv_sec &&
        tv.tv_usec == ac->c.timeout->tv_usec) {
        return;
    }

ivykis.h:58

    e = (redisIvykisEvents*)malloc(sizeof(*e)); // e may be null
    e->context = ac;

libevent.h:155

    e = (redisLibeventEvents*)calloc(1, sizeof(*e)); // e may be null
    e->context = ac;
@michael-grunder
Copy link
Collaborator

Fixed via #754

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants