]> git.codecow.com Git - Monocypher.git/commit
Fixed (NULL + 0) undefined behaviour
authorLoup Vaillant <loup@loup-vaillant.fr>
Mon, 20 Apr 2020 11:59:31 +0000 (13:59 +0200)
committerLoup Vaillant <loup@loup-vaillant.fr>
Mon, 20 Apr 2020 11:59:31 +0000 (13:59 +0200)
commitea6a80ccdcbaef6faeb03d0d80c0cbb2e070ed48
treee2af76a0f6beaf172264ff062e985a604ae73515
parent0ee37bff95e4e441f8e5d560cd2c7bb7f931eb39
Fixed (NULL + 0) undefined behaviour

It appears that arithmetic on NULL pointers is undefined, even when we
just add zero.

Monocypher generally allows input buffers to be NULL pointers if their
length is zero.  This is because we never dereference those pointers in
this case.  Likewise, we should not perform any arithmetic on them.

The fix is to return immediately when the input buffer length is zero.
src/monocypher.c
src/optional/monocypher-ed25519.c