Commit 3c55aec6 authored by Kurt Roeckx's avatar Kurt Roeckx
Browse files

Don't call memcpy with NULL as source



Calling it with lenght 0 and NULL as source is undefined behaviour.

Reviewed-by: default avatarRich Salz <rsalz@openssl.org>
GH: #2089
(cherry picked from commit eeab356c)
parent 0baae1c0
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -167,6 +167,7 @@ int bn_copy_words(BN_ULONG *out, const BIGNUM *in, int size)
        return 0;
        return 0;


    memset(out, 0, sizeof(*out) * size);
    memset(out, 0, sizeof(*out) * size);
    if (in->d != NULL)
        memcpy(out, in->d, sizeof(*out) * in->top);
        memcpy(out, in->d, sizeof(*out) * in->top);
    return 1;
    return 1;
}
}