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
+2
View File
@@ -4,6 +4,8 @@
RDS95 is a light software RDS encoder for linux 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) 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)) 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))
+4 -4
View File
@@ -21,8 +21,8 @@ int lua_set_userdata(lua_State *localL) {
size_t len; size_t len;
const char *data = luaL_checklstring(localL, 1, &len); const char *data = luaL_checklstring(localL, 1, &len);
if(len > LUA_USER_DATA) return luaL_error(localL, "data exceeds limit"); 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); memset(mod->enc->data[mod->enc->program].lua_data, 0, LUA_USER_DATA);
memcpy(&mod->enc->data[mod->enc->program].lua_data, data, len); memcpy(mod->enc->data[mod->enc->program].lua_data, data, len);
return 0; return 0;
} }
@@ -33,8 +33,8 @@ int lua_set_userdata_offset(lua_State *localL) {
size_t len; size_t len;
const char *data = luaL_checklstring(localL, 3, &len); const char *data = luaL_checklstring(localL, 3, &len);
if(len > size || (offset + size) > LUA_USER_DATA) return luaL_error(localL, "data exceeds limit"); 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); memset(mod->enc->data[mod->enc->program].lua_data + offset, 0, size);
memcpy((&mod->enc->data[mod->enc->program].lua_data)+offset, data, len); memcpy(mod->enc->data[mod->enc->program].lua_data + offset, data, len);
return 0; return 0;
} }