aboutsummaryrefslogtreecommitdiffstats
path: root/util-src
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2020-06-24 12:34:20 +0100
committerMatthew Wild <mwild1@gmail.com>2020-06-24 12:34:20 +0100
commitb9a670dace9252eaaf3de5871e5a1c6d355989fb (patch)
tree53952699c957a0993c80041b7c1cbdce42491cdc /util-src
parentf7614d491a12872231226995f4707fa9ff8dec9a (diff)
downloadprosody-b9a670dace9252eaaf3de5871e5a1c6d355989fb.tar.gz
prosody-b9a670dace9252eaaf3de5871e5a1c6d355989fb.zip
util.ringbuffer: Ensure unsigned chars are always returned from :byte()
Diffstat (limited to 'util-src')
-rw-r--r--util-src/ringbuffer.c6
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;
}