[tfman] fix two problems found by fuzzing #2475

This commit is contained in:
nick black 2021-12-15 04:27:13 -05:00 committed by nick black
parent acffa61557
commit 5ea69031ca
2 changed files with 8 additions and 6 deletions

View File

@ -351,11 +351,13 @@ draw_domnode(struct ncplane* p, const pagedom* dom, const pagenode* n,
putpara(p, n->text);
}
}else{
ncplane_set_styles(p, NCSTYLE_BOLD | NCSTYLE_ITALIC);
ncplane_set_fg_rgb(p, 0xff6a00);
ncplane_putstr_aligned(p, -1, NCALIGN_CENTER, n->text);
ncplane_set_fg_default(p);
ncplane_set_styles(p, NCSTYLE_NONE);
if(n->text){
ncplane_set_styles(p, NCSTYLE_BOLD | NCSTYLE_ITALIC);
ncplane_set_fg_rgb(p, 0xff6a00);
ncplane_putstr_aligned(p, -1, NCALIGN_CENTER, n->text);
ncplane_set_fg_default(p);
ncplane_set_styles(p, NCSTYLE_NONE);
}
}
*wrotetext = true;
break;

View File

@ -104,7 +104,7 @@ const trofftype* get_type(const struct troffnode* trie, const unsigned char** ws
++*ws;
--len;
while(len && !isspace(**ws) && **ws){
if(**ws > sizeof(trie->next) / sizeof(*trie->next)){ // illegal command
if(**ws >= sizeof(trie->next) / sizeof(*trie->next)){ // illegal command
return NULL;
}
if((trie = trie->next[**ws]) == NULL){