0
1
mirror of https://github.com/radio95-rnt/rds95.git synced 2026-02-26 20:33:53 +01:00

fix segfault

This commit is contained in:
2025-12-25 21:50:33 +01:00
parent 394c26a49e
commit 60c9d1735f
2 changed files with 6 additions and 4 deletions

View File

@@ -4,6 +4,8 @@
RDS95 is a light software RDS encoder for linux
RDS95 also embeds Lua to implement some things
RDS95 follows the IEC 62106 standard (available at the RDS Forum website)
Also, yes i would like to license this under the unlicese but the tyranny of the GPL license restricts me from doing that, this is a message to you, anthony (see the [disclaimer](#disclaimer))

View File

@@ -21,8 +21,8 @@ int lua_set_userdata(lua_State *localL) {
size_t len;
const char *data = luaL_checklstring(localL, 1, &len);
if(len > LUA_USER_DATA) return luaL_error(localL, "data exceeds limit");
memset(&mod->enc->data[mod->enc->program].lua_data, 0, LUA_USER_DATA);
memcpy(&mod->enc->data[mod->enc->program].lua_data, data, len);
memset(mod->enc->data[mod->enc->program].lua_data, 0, LUA_USER_DATA);
memcpy(mod->enc->data[mod->enc->program].lua_data, data, len);
return 0;
}
@@ -33,8 +33,8 @@ int lua_set_userdata_offset(lua_State *localL) {
size_t len;
const char *data = luaL_checklstring(localL, 3, &len);
if(len > size || (offset + size) > LUA_USER_DATA) return luaL_error(localL, "data exceeds limit");
memset((&mod->enc->data[mod->enc->program].lua_data)+offset, 0, size);
memcpy((&mod->enc->data[mod->enc->program].lua_data)+offset, data, len);
memset(mod->enc->data[mod->enc->program].lua_data + offset, 0, size);
memcpy(mod->enc->data[mod->enc->program].lua_data + offset, data, len);
return 0;
}