blaze822: blaze822_addr: null-terminate ttok at the current position before appending

pull/173/head
Leah Neukirchen 4 years ago
parent 3370fd5f70
commit e56f8ad294

@ -277,6 +277,7 @@ blaze822_addr(char *s, char **dispo, char **addro)
if (memchr(tok, '@', c - tok))
not_addr = 1; // @ inside "" is never an addr
*tc = 0;
tc += safe_append(ttok, sizeof ttok, tok, c);
} else if (*s == '(') {
char *z = skip_comment(s);

@ -1,7 +1,7 @@
#!/bin/sh
cd ${0%/*}
. ./lib.sh
plan 31
plan 33
check_addr() {
printf "From: %s\n" "$1" | check_test "parse $1" = "$2" "maddr /dev/stdin"
@ -46,3 +46,6 @@ check_addr 'test."test"@example.org' 'test.test@example.org'
check_addr '<test."test"@example.org>' 'test.test@example.org'
check_addr 'test"test"@example.org' 'testtest@example.org'
check_addr '<test"test"@example.org>' 'testtest@example.org'
check_addr 'foo<bar@example.org>' 'foo <bar@example.org>'
check_addr 'xxxxxxxxx a"test"@example.org' "xxxxxxxxx <atest@example.org>"

Loading…
Cancel
Save