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
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:
+2
-5
@@ -84,7 +84,7 @@ function pastLatin1(text: string): { err: Error } | undefined {
|
||||
|
||||
if (index === -1) return undefined;
|
||||
|
||||
const code = text.charCodeAt(index).toString(16).toUpperCase().padStart(4, '0');
|
||||
const code = (text.codePointAt(index) ?? 0).toString(16).toUpperCase().padStart(4, '0');
|
||||
|
||||
return {
|
||||
err: new Error(
|
||||
@@ -103,7 +103,6 @@ function wantText(value: ParamValue): Result<{ text: string }> {
|
||||
return pastLatin1(text) ?? { text };
|
||||
}
|
||||
|
||||
/** A C-Octet String ends at its first NULL, so one inside the value truncates the field on the peer. */
|
||||
function wantCstringText(value: ParamValue): Result<{ text: string }> {
|
||||
const { err, text } = wantText(value);
|
||||
|
||||
@@ -114,9 +113,7 @@ function wantCstringText(value: ParamValue): Result<{ text: string }> {
|
||||
if (index === -1) return { text };
|
||||
|
||||
return {
|
||||
err: new Error(
|
||||
`U+0000 at index ${String(index)} would end the C-Octet String there, ${String(text.length - index - 1)} characters early`,
|
||||
),
|
||||
err: new Error(`U+0000 at index ${String(index)} would end the C-Octet String there`),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user