Cover the guarded address writers, and cut what the code already says
Mirror / push (push) Successful in 5s
Test / lint (pull_request) Successful in 22s
Test / test (18) (pull_request) Successful in 29s
Test / test (20) (pull_request) Successful in 30s
Test / test (22) (pull_request) Successful in 37s
Test / test (24) (pull_request) Successful in 29s
Test / test (26) (pull_request) Successful in 30s

This commit is contained in:
2026-09-21 08:08:42 +02:00
parent c1e0407942
commit f870b7530f
8 changed files with 68 additions and 45 deletions
+2 -5
View File
@@ -128,7 +128,6 @@ describe('parsing real PDUs', () => {
assert.equal(pduObj.tlvs.message_state?.tagValue, 2);
});
// 'ascii' masks bit 7 on the way in, so this address used to come back Kaffei.
test('keeps an alphanumeric sender whole through the wire and back', () => {
const pdu = encode({
cmdName: 'deliver_sm',
@@ -143,12 +142,9 @@ describe('parsing real PDUs', () => {
assert.ok(pdu.includes(Buffer.from('Kaffeé', 'latin1')));
assert.equal(decode(pdu).params.source_addr, 'Kaffeé');
assert.ok(objToPdu({ cmdName: 'deliver_sm', params: { source_addr: '一' } }).err instanceof Error);
});
// The peer reads source_addr to the first NULL and every mandatory field behind it shifts, so an
// application forwarding a customer's sender id could have a PDU rewritten under it.
test('refuses an address carrying its own terminator', () => {
test('refuses an address the field cannot carry rather than truncating it', () => {
const smuggled = objToPdu({
cmdName: 'submit_sm',
params: { destination_addr: '46709771337', source_addr: '46701113311\u0000EVIL' },
@@ -156,6 +152,7 @@ describe('parsing real PDUs', () => {
assert.ok(smuggled.err instanceof Error);
assert.equal(smuggled.buffer, undefined);
assert.ok(objToPdu({ cmdName: 'deliver_sm', params: { source_addr: '一' } }).err instanceof Error);
});
});