MEDIUM: server: Don't load server-state file if a line is corrupted
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 16 Feb 2021 10:51:12 +0000 (11:51 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 25 Feb 2021 09:02:39 +0000 (10:02 +0100)
commita67c6bf333611cfb60dffa50bea1d7afe688b89e
tree0e6611dd497afbd0de6f9d8a721e34bbff6aaa8b
parentd0a5e84c8d10699f0b1b871a41dd59bb38a9b007
MEDIUM: server: Don't load server-state file if a line is corrupted

This change is not huge but may have a visible impact for users. Now, if a
line of a server-state file is corrupted, the whole file is ignored. A
warning is emitted with the corrupted line number.

In fact, there is no way to recover from a corrupted line. A line is
considered as corrupted if it is too long (truncated line) or if it contains
the wrong number of arguments. In both cases, it means the file was forged
(or at least manually edited). It is safer to ignore it.

Note for now, memory allocation errors are not reported and the
corresponding line is silently ignored.
src/server.c