otrv4 / libotr-ng

A new implementation of OTR with support for version 4. This is a mirror of https://bugs.otr.im/otrv4/libotr-ng
Other
43 stars 9 forks source link

otrng_serialize_ec_point return value interpreted incorrectly #207

Closed osmk closed 5 years ago

osmk commented 5 years ago

Hi, I was looking through the code and happened to notice a minor issue. It doesn't actually have any impact on the function but is semantically incorrect or at least confusing...

https://github.com/otrv4/libotr-ng/blob/c6185352b30ef788e9b1eba0f88be2c57ebce9e1/src/persistence.c#L923

otrng_serialize_ec_point() returns an int number of bytes serialised, but here it is interpreted as if it returned an otrng_result. It happens to work in practice because ED448_POINT_BYTES isn't equal to OTRNG_ERROR, but the line should probably read something as follows for correctness

if (otrng_serialize_ec_point(forg_ser, *client->forging_key) != ED448_POINT_BYTES) {

Do you want me to open a PR?

claucece commented 5 years ago

Hey!

Thanks. It should be fixed now ;)

Thanks!