mirror of
				https://github.com/lunarmodules/luasocket.git
				synced 2025-10-31 10:25:55 +01:00 
			
		
		
		
	Fix HORRIBLE but in b64/qp code.
Bug was caught by user moteus. Code was checking if arguments was nil after using luaL_Buffer code, which messes with the stack. Simple to fix, though.
This commit is contained in:
		| @@ -29,7 +29,7 @@ DEBUG?=NODEBUG | |||||||
| # LUAINC_macosx:  | # LUAINC_macosx:  | ||||||
| # /opt/local/include | # /opt/local/include | ||||||
| LUAINC_macosx_base?=/opt/local/include | LUAINC_macosx_base?=/opt/local/include | ||||||
| LUAINC_macosx?=$(LUAINC_macosx_base)$(LUAV) | LUAINC_macosx?=$(LUAINC_macosx_base)/lua$(LUAV) | ||||||
| # FIXME default should this default to fink or to macports? | # FIXME default should this default to fink or to macports? | ||||||
| # What happens when more than one Lua version is installed? | # What happens when more than one Lua version is installed? | ||||||
| LUAPREFIX_macosx?=/opt/local/ | LUAPREFIX_macosx?=/opt/local/ | ||||||
|   | |||||||
| @@ -263,6 +263,8 @@ static int mime_global_b64(lua_State *L) | |||||||
|         lua_pushnil(L); |         lua_pushnil(L); | ||||||
|         return 2; |         return 2; | ||||||
|     } |     } | ||||||
|  |     /* make sure we don't confuse buffer stuff with arguments */ | ||||||
|  |     lua_settop(L, 2); | ||||||
|     /* process first part of the input */ |     /* process first part of the input */ | ||||||
|     luaL_buffinit(L, &buffer); |     luaL_buffinit(L, &buffer); | ||||||
|     while (input < last)  |     while (input < last)  | ||||||
| @@ -307,6 +309,8 @@ static int mime_global_unb64(lua_State *L) | |||||||
|         lua_pushnil(L); |         lua_pushnil(L); | ||||||
|         return 2; |         return 2; | ||||||
|     } |     } | ||||||
|  |     /* make sure we don't confuse buffer stuff with arguments */ | ||||||
|  |     lua_settop(L, 2); | ||||||
|     /* process first part of the input */ |     /* process first part of the input */ | ||||||
|     luaL_buffinit(L, &buffer); |     luaL_buffinit(L, &buffer); | ||||||
|     while (input < last)  |     while (input < last)  | ||||||
| @@ -458,6 +462,8 @@ static int mime_global_qp(lua_State *L) | |||||||
|         lua_pushnil(L); |         lua_pushnil(L); | ||||||
|         return 2; |         return 2; | ||||||
|     } |     } | ||||||
|  |     /* make sure we don't confuse buffer stuff with arguments */ | ||||||
|  |     lua_settop(L, 3); | ||||||
|     /* process first part of input */ |     /* process first part of input */ | ||||||
|     luaL_buffinit(L, &buffer); |     luaL_buffinit(L, &buffer); | ||||||
|     while (input < last) |     while (input < last) | ||||||
| @@ -531,6 +537,8 @@ static int mime_global_unqp(lua_State *L) | |||||||
|         lua_pushnil(L); |         lua_pushnil(L); | ||||||
|         return 2; |         return 2; | ||||||
|     } |     } | ||||||
|  |     /* make sure we don't confuse buffer stuff with arguments */ | ||||||
|  |     lua_settop(L, 2); | ||||||
|     /* process first part of input */ |     /* process first part of input */ | ||||||
|     luaL_buffinit(L, &buffer); |     luaL_buffinit(L, &buffer); | ||||||
|     while (input < last) |     while (input < last) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user