journal-upload: add asserts that snprintf does not return an error
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 2 Oct 2018 10:46:31 +0000 (12:46 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 2 Oct 2018 13:36:24 +0000 (15:36 +0200)
commit91db8ed5b2e67abf738381a6ed6a05a8271498cd
treee3c5501ed5ecb6251bae228f5e3f10f09d5207e4
parent7c3733d5defb5428ddfeefae6d80fcbcc253e7ef
journal-upload: add asserts that snprintf does not return an error

LGMT complains:
> The size argument of this snprintf call is derived from its return value,
> which may exceed the size of the buffer and overflow.

Let's make sure that r is non-negative. (This shouldn't occur unless the format
string is borked, so let's just add an assert.)
Then, let's reorder the comparison to avoid the potential overflow.
src/journal-remote/journal-upload-journal.c