Fix bug in rotbuf_next_chunk() when rotation == 0

Caused occasional infinite loop in "keyring add" command and others
This commit is contained in:
Andrew Bettison 2013-05-15 16:46:39 +09:30
parent 118dcca40b
commit 3c8643289e

View File

@ -52,6 +52,8 @@ int rotbuf_next_chunk(struct rotbuf *rb, unsigned char **bufp, size_t *lenp)
*bufp = rb->cursor; *bufp = rb->cursor;
*lenp = rb->ebuf - rb->cursor; *lenp = rb->ebuf - rb->cursor;
rb->cursor = rb->buf; rb->cursor = rb->buf;
if (rb->cursor == rb->start)
++rb->wrap;
return 1; return 1;
} }
*bufp = rb->cursor; *bufp = rb->cursor;