aboutsummaryrefslogtreecommitdiff
path: root/libseat/backend
diff options
context:
space:
mode:
Diffstat (limited to 'libseat/backend')
-rw-r--r--libseat/backend/seatd.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/libseat/backend/seatd.c b/libseat/backend/seatd.c
index fd424b5..0b8064d 100644
--- a/libseat/backend/seatd.c
+++ b/libseat/backend/seatd.c
@@ -165,14 +165,13 @@ static size_t read_header(struct backend_seatd *backend, uint16_t expected_opcod
return SIZE_MAX;
}
if (header.opcode != expected_opcode) {
- connection_restore(&backend->connection, sizeof header);
struct proto_server_error msg;
if (header.opcode != SERVER_ERROR) {
log_errorf("Unexpected response: expected opcode %d, received opcode %d",
expected_opcode, header.opcode);
set_error(backend);
errno = EBADMSG;
- } else if (conn_get(backend, &msg, sizeof msg) == -1) {
+ } else if (header.size != sizeof msg || conn_get(backend, &msg, sizeof msg) == -1) {
set_error(backend);
errno = EBADMSG;
} else {