@@ -109,6 +109,12 @@ static void process_message( intf_header_t const * header, void const * payload
109109 */
110110static void process_message_request_autokey ( intf_header_t const * header , void const * payload );
111111
112+ /**
113+ * @fn process_message_request_autokey_ex( intf_header_t const *, void const * )
114+ * @brief Processes the specified interface message with the `INTF_MESSAGE_REQUEST_AUTOKEY_EX` message ID.
115+ */
116+ static void process_message_request_autokey_ex ( intf_header_t const * header , void const * payload );
117+
112118/**
113119 * @fn process_message_request_get_buzzer_enabled( intf_header_t const *, void const * )
114120 * @brief Processes the specified interface message with the `INTF_MESSAGE_REQUEST_GET_BUZZER_ENABLED` message ID.
@@ -386,6 +392,10 @@ static void process_message( intf_header_t const * header, void const * payload
386392 process_message_request_autokey ( header , payload );
387393 break ;
388394
395+ case INTF_MESSAGE_REQUEST_AUTOKEY_EX :
396+ process_message_request_autokey_ex ( header , payload );
397+ break ;
398+
389399 case INTF_MESSAGE_REQUEST_GET_BUZZER_ENABLED :
390400 process_message_request_get_buzzer_enabled ( header , payload );
391401 break ;
@@ -501,9 +511,10 @@ static void process_message( intf_header_t const * header, void const * payload
501511
502512static void process_message_request_autokey ( intf_header_t const * header , void const * payload )
503513{
504- // Ensure string is null terminated
505514 char const * str = ( char const * )payload ;
506- if ( str [ header -> size - 1 ] != NULL_CHAR )
515+
516+ // Ensure we have enough data and string is null terminated
517+ if ( header -> size == 0 || str [ header -> size - 1 ] != NULL_CHAR )
507518 {
508519 send_empty_packet ( INTF_MESSAGE_REPLY_INVALID_PAYLOAD );
509520 return ;
@@ -518,6 +529,34 @@ static void process_message_request_autokey( intf_header_t const * header, void
518529} /* process_message_request_autokey() */
519530
520531
532+ static void process_message_request_autokey_ex ( intf_header_t const * header , void const * payload )
533+ {
534+ typedef struct
535+ {
536+ keyer_autokey_flag_field_t flags ;
537+ char c ;
538+ } format_t ;
539+
540+ format_t const * pkt = ( format_t const * )payload ;
541+ char const * str = ( char const * )( & pkt -> c );
542+
543+ // Ensure we have enough data and string is null terminated
544+ if ( header -> size < sizeof ( format_t ) ||
545+ str [ header -> size - sizeof ( keyer_autokey_flag_field_t ) - 1 ] != NULL_CHAR )
546+ {
547+ send_empty_packet ( INTF_MESSAGE_REPLY_INVALID_PAYLOAD );
548+ return ;
549+ }
550+
551+ // Key string
552+ keyer_autokey_str_ex ( str , pkt -> flags );
553+
554+ // Send reply
555+ send_empty_packet ( INTF_MESSAGE_REPLY_SUCCESS );
556+
557+ } /* process_message_request_autokey_ex() */
558+
559+
521560static void process_message_request_get_buzzer_enabled ( intf_header_t const * header , void const * payload )
522561{
523562 ( void )payload ;
0 commit comments