Skip to content

Commit

Permalink
library: don't do arithmetic on void*
Browse files Browse the repository at this point in the history
  • Loading branch information
Adamcake committed Nov 16, 2024
1 parent 03e105a commit c86ce42
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/library/plugin/plugin_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1392,7 +1392,7 @@ static int api_buffer_setstring(lua_State* state) {
lua_pushfstring(state, "buffer setstring: out-of-bounds write (buffer length %lu, writing %lu bytes at %li)", buffer->size, size, offset);
lua_error(state);
}
memcpy(buffer->data + offset, data, size);
memcpy((uint8_t*)buffer->data + offset, data, size);
return 0;
}

Expand All @@ -1404,7 +1404,7 @@ static int api_buffer_setbuffer(lua_State* state) {
lua_pushfstring(state, "buffer setbuffer: out-of-bounds write (buffer length %lu, writing %lu bytes at %li)", buffer->size, srcbuffer->size, offset);
lua_error(state);
}
memcpy(buffer->data + offset, srcbuffer->data, srcbuffer->size);
memcpy((uint8_t*)buffer->data + offset, srcbuffer->data, srcbuffer->size);
return 0;
}

Expand Down

0 comments on commit c86ce42

Please sign in to comment.