diff options
author | jaseg <git@jaseg.net> | 2018-11-13 15:51:35 +0900 |
---|---|---|
committer | jaseg <git@jaseg.net> | 2018-11-13 15:51:35 +0900 |
commit | 587ecdd72d8d186732651aada681c0327d34924a (patch) | |
tree | 11c8f6d4bb15d718d493bdbff1c2f31890676e30 /src/cobs.c | |
parent | af15c38a054d969e9dd46e2c547a7064bce4a662 (diff) | |
download | secure-hid-587ecdd72d8d186732651aada681c0327d34924a.tar.gz secure-hid-587ecdd72d8d186732651aada681c0327d34924a.tar.bz2 secure-hid-587ecdd72d8d186732651aada681c0327d34924a.zip |
Host handshake mostly working
Diffstat (limited to 'src/cobs.c')
-rw-r--r-- | src/cobs.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -216,7 +216,7 @@ void cobs_decode_incremental_initialize(struct cobs_decode_state *state) { int cobs_decode_incremental(struct cobs_decode_state *state, char *dst, size_t dstlen, char src) { if (state->p == 0) { if (src == 0) - goto errout; /* invalid framing. An empty frame would be [...] 00 01 00, not [...] 00 00 */ + goto empty_errout; /* invalid framing. An empty frame would be [...] 00 01 00, not [...] 00 00 */ state->c = (unsigned char)src; state->p++; return 0; @@ -250,6 +250,10 @@ int cobs_decode_incremental(struct cobs_decode_state *state, char *dst, size_t d errout: cobs_decode_incremental_initialize(state); return -1; + +empty_errout: + cobs_decode_incremental_initialize(state); + return -3; } #ifdef VALIDATION |