mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
fix(parser): reject malformed MAC inputs and make print helpers banked
parse_mac now accepts only a strict aa:bb:cc:dd:ee:ff (or '-' separators) form: each octet is exactly two hex digits, the 5 separators are a single consistent character, and nothing is allowed after the 6th octet. This rejects the malformed values the reviewer flagged (repeated separators, missing digits, trailing characters). A new inline hexval() helper does the digit-to-value conversion and can be reused by future commands. print_mac and print_ip are marked __banked to match cmd_parser(), which lives in codeseg BANK2 and is itself __banked, so callers across the code bank work correctly. cmd_parser.h is updated with the new prototypes and the __banked qualifier on print_ip. Verified with make MACHINE=KP_9000_9XHML_X_V3_1: the build links cleanly and the internal-RAM (DSEG) layout is unchanged against main; XSEG is unchanged and ROM grows by 184 bytes. A host-side test confirms parse_mac rejects the two malformed inputs from the review.
This commit is contained in:
1 parent
6616a0c9ce
commit
dc4fb5becc
2 files changed
+45
-25
No files matched your search
+3
-1
@@ -13,7 +13,9 @@ void cmd_tokenize(void) __banked;
|
||||
void cmd_parser(void) __banked;
|
||||
void execute_config(void) __banked;
|
||||
void execute_commands(__xdata uint8_t *p) __banked;
|
||||
void print_ip(__xdata uint8_t *ptr);
|
||||
void print_ip(__xdata uint8_t *ptr) __banked;
|
||||
void print_mac(__xdata uint8_t *ptr) __banked;
|
||||
uint8_t parse_mac(uint8_t idx, __xdata uint8_t *mac);
|
||||
void print_sw_version(void) __banked;
|
||||
void clear_command_history(void) __banked;
|
||||
|
||||
|
||||
Reference in new issue
Block a user