From 6938cdbaede7eb63b9bc2adb9e0a93e243e291ee Mon Sep 17 00:00:00 2001 From: jussi Date: Mon, 10 Apr 2023 16:05:45 +0300 Subject: LoadShaderFromMemory fix. --- src/core.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/core.c') diff --git a/src/core.c b/src/core.c index bcc00ee..84b6991 100644 --- a/src/core.c +++ b/src/core.c @@ -248,7 +248,7 @@ int lcoreSetWindowMinSize( lua_State *L ) { } /* -> position = RL.GetMonitorPosition( ) +> position = RL.GetMonitorPosition( int monitor ) Get specified monitor position @@ -1022,18 +1022,17 @@ int lcoreLoadShaderFromMemory( lua_State *L ) { lua_pushinteger( L, -1 ); return 1; } - char *vs = NULL; char *fs = NULL; if ( lua_isstring( L, 1 ) ) { - size_t vsLen = lua_rawlen( L, 1 ); + size_t vsLen = lua_rawlen( L, 1 ) + 1; vs = malloc( vsLen * sizeof( char ) ); strcpy( vs, lua_tostring( L, 1 ) ); } if ( lua_isstring( L, 2 ) ) { - size_t fsLen = lua_rawlen( L, 2 ); + size_t fsLen = lua_rawlen( L, 2 ) + 1; fs = malloc( fsLen * sizeof( char ) ); strcpy( fs, lua_tostring( L, 2 ) ); -- cgit v1.2.3