File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -617,10 +617,16 @@ static NativeHandlerResult consume_mailbox(Context *ctx)
617617 TRACE ("\n" );
618618#endif
619619
620- term pid = term_get_tuple_element (msg , 0 );
621- term ref = term_get_tuple_element (msg , 1 );
620+ GenMessage gen_message ;
621+ if (UNLIKELY (port_parse_gen_message (msg , & gen_message ) != GenCallMessage )) {
622+ ESP_LOGW (TAG , "Received invalid message." );
623+ mailbox_remove_message (& ctx -> mailbox , & ctx -> heap );
624+ return NativeContinue ;
625+ }
626+ term pid = gen_message .pid ;
627+ term ref = gen_message .ref ;
622628 uint64_t ref_ticks = term_to_ref_ticks (ref );
623- term req = term_get_tuple_element ( msg , 2 ) ;
629+ term req = gen_message . req ;
624630
625631 NativeHandlerResult result = NativeContinue ;
626632 if (term_is_atom (req )) {
You can’t perform that action at this time.
0 commit comments