fix reading beyond actual size
authorMichael Wallner <mike@php.net>
Tue, 4 Dec 2018 10:25:10 +0000 (11:25 +0100)
committerMichael Wallner <mike@php.net>
Tue, 4 Dec 2018 11:13:51 +0000 (12:13 +0100)
src/types/let_exp.c

index 382fd62..4ce32a2 100644 (file)
@@ -247,9 +247,11 @@ void *psi_let_exp_exec(struct psi_let_exp *val, struct psi_decl_arg *darg,
                        struct psi_impl *impl = psi_call_frame_get_impl(frame);
                        struct psi_let_stmt *let_temp = psi_impl_get_let(impl, val->data.var);
                        struct psi_call_frame_symbol *temp_arg;
+                       impl_val *src;
 
                        temp_arg = psi_call_frame_fetch_symbol(frame, let_temp->exp->var);
-                       frame_sym->temp_val = *deref_impl_val(temp_arg->ptr, val->data.var);
+                       src = deref_impl_val(temp_arg->ptr, val->data.var);
+                       memcpy(&frame_sym->temp_val, src, psi_decl_var_get_size(let_temp->exp->var));
                }
                break;