diff options
author | Matthew Wild <mwild1@gmail.com> | 2020-06-24 12:34:20 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2020-06-24 12:34:20 +0100 |
commit | 512f97b32f8de0878f9a97a385f7105cd7fce5b7 (patch) | |
tree | 53952699c957a0993c80041b7c1cbdce42491cdc /util-src/ringbuffer.c | |
parent | 240f8628053e0fd728c720e9bde78760b963f551 (diff) | |
download | prosody-512f97b32f8de0878f9a97a385f7105cd7fce5b7.tar.gz prosody-512f97b32f8de0878f9a97a385f7105cd7fce5b7.zip |
util.ringbuffer: Ensure unsigned chars are always returned from :byte()
Diffstat (limited to 'util-src/ringbuffer.c')
-rw-r--r-- | util-src/ringbuffer.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/util-src/ringbuffer.c b/util-src/ringbuffer.c index 007aa2ec..0f250c12 100644 --- a/util-src/ringbuffer.c +++ b/util-src/ringbuffer.c @@ -262,15 +262,15 @@ static int rb_byte(lua_State *L) { if(calc_splice_positions(b, start, end, &wrapped_start, &wrapped_end)) { if(wrapped_end <= wrapped_start) { for(i = wrapped_start; i < (long)b->alen; i++) { - lua_pushinteger(L, b->buffer[i]); + lua_pushinteger(L, (unsigned char)b->buffer[i]); } for(i = 0; i < wrapped_end; i++) { - lua_pushinteger(L, b->buffer[i]); + lua_pushinteger(L, (unsigned char)b->buffer[i]); } return wrapped_end + (b->alen - wrapped_start); } else { for(i = wrapped_start; i < wrapped_end; i++) { - lua_pushinteger(L, b->buffer[i]); + lua_pushinteger(L, (unsigned char)b->buffer[i]); } return wrapped_end - wrapped_start; } |