nats-io / nats.c

A C client for NATS
Apache License 2.0
390 stars 137 forks source link

[FIXED] Random authentication error due to missing signature #705

Closed tyler92 closed 9 months ago

tyler92 commented 9 months ago

Sometimes there is an authentication error due to a missing signature when natsOptions_SetUserCredentialsFromMemory is used:

[1] 2023/12/29 13:23:44.880932 [ERR] 172.18.0.1:33898 - cid:36 - authentication error

The problem is that _base64Encode doesn't do anything if the first byte is zero. Since the function works with strings and bytes, it makes sense to check srcLen instead of the first byte.