* The string gets converted to a network-order
* 8-byte number, and then the lower bytes of
* that get copied to the ethernet address.
+ *
+ * Note: We need to check for a terminal sequence
+ * after the number, else we may just end up
+ * parsing the first hexit and returning.
+ *
+ * i.e. 1c:00:00:00:00 -> 1
*/
- if ((fr_sbuff_out(NULL, &num, &our_in) > 0) && !fr_sbuff_is_char(&our_in, ':')) {
+ if ((fr_sbuff_out(NULL, &num, &our_in) > 0) && fr_sbuff_is_terminal(&our_in, rules->terminals)) {
num = htonll(num);
fr_dbuff_in_memcpy(&dbuff, ((uint8_t *) &num) + 2, sizeof(dst->vb_ether));
if (slen <= 0) return slen;
if (slen != (ssize_t)inlen) {
- fr_strerror_printf("%zu bytes of trailing data after string value \"%pV\"",
+ fr_strerror_printf("Failed parsing '%s'. %zu bytes of trailing data after string value \"%pV\"",
+ fr_type_to_str(dst_type),
inlen - slen,
fr_box_strvalue_len(in + slen, inlen - slen));
return (slen - inlen) - 1;
--- /dev/null
+
+# In the original failure parsing the mac-address results in a "trailing garbage" error
+map json '{"externalId":"10000000001","osFamily":"IOS","macAddress":"6C:4D:73:8B:51:00","guid":"Enrollment-000000000-0000-0000-0000-000000000000","isRevoked":false,"configurationType":"HS2R1","certificateSerialNumber":"0000c92c8d4896458ecfb70323d5cf81ddc0000","isExpired":false}' {
+ &Tmp-String-0 := '$.externalId'
+ &Tmp-Ethernet-0 := '$.macAddress'
+}
+
+if (&Tmp-String-0 != "10000000001") {
+ test_fail
+}
+
+if (&Tmp-Ethernet-0 != 6C:4D:73:8B:51:00) {
+ test_fail
+}
+
+test_pass