diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2014-05-07 16:19:03 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2014-05-07 16:19:03 +0000 |
commit | 19bffaab56fdffeb7dd12f469c69521b30a46f56 (patch) | |
tree | 30b63b7f4b7f7cb94a791ef190a8c6b7d78d8752 /mandocdb.c | |
parent | 9530f39e422a0f12346c8786e84e0137349ed81a (diff) | |
download | mandoc-19bffaab56fdffeb7dd12f469c69521b30a46f56.tar.gz |
Render roff escape sequences contained in manual page descriptions
before putting them into the mpages table.
Issue found by bentley@ in OpenBSD::Getopt(3p).
Diffstat (limited to 'mandocdb.c')
-rw-r--r-- | mandocdb.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -2036,13 +2036,22 @@ dbadd(struct mpage *mpage, struct mchars *mc) if (debug) say(mlink->file, "Adding to database"); + i = strlen(mpage->desc) + 1; + key = mandoc_calloc(1, sizeof(struct str) + i); + memcpy(key->key, mpage->desc, i); + render_key(mc, key); + i = 1; - SQL_BIND_TEXT(stmts[STMT_INSERT_PAGE], i, mpage->desc); + SQL_BIND_TEXT(stmts[STMT_INSERT_PAGE], i, key->rendered); SQL_BIND_INT(stmts[STMT_INSERT_PAGE], i, FORM_SRC == mpage->form); SQL_STEP(stmts[STMT_INSERT_PAGE]); mpage->pageid = sqlite3_last_insert_rowid(db); sqlite3_reset(stmts[STMT_INSERT_PAGE]); + if (key->rendered != key->key) + free(key->rendered); + free(key); + while (NULL != mlink) { dbadd_mlink(mlink); mlink = mlink->next; |