tapas

A small program used for compiling refer output into the APA reference format.
git clone git://git.noxz.tech/tapas
Log | Files | Refs | README | LICENSE

commit 14509d80f2aa0ee7753a5fa3733880c211a548d7
parent 10d4bd82a9c50e2c08530b53aece3762250fbcc2
Author: Chris Noxz <chris@noxz.tech>
Date:   Sun,  9 Feb 2020 15:10:02 +0100

Fix overflow error

Diffstat:
Mconfig.def.h | 2+-
Mtapas.c | 52++++++++++++++++++++++++++--------------------------
2 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -1 +1 @@ -#define BUF_SIZE 128 +#define BUF_SIZE 256 diff --git a/tapas.c b/tapas.c @@ -171,32 +171,32 @@ void setattr(char type, char *val) { switch (type) { - case 'A': strcpy(state.ref->author, val); break; - case 'T': strcpy(state.ref->title, val); break; - case 'B': strcpy(state.ref->book_title, val); break; - case 'R': strcpy(state.ref->report_number, val); break; - case 'J': strcpy(state.ref->journal_name, val); break; - case 'E': strcpy(state.ref->editor, val); break; - case 'e': strcpy(state.ref->edition, val); break; - case 'V': strcpy(state.ref->volume, val); break; - case 'N': strcpy(state.ref->journal_number, val); break; - case 'S': strcpy(state.ref->series, val); break; - case 'C': strcpy(state.ref->city, val); break; - case 'I': strcpy(state.ref->publisher, val); break; - case 'D': strcpy(state.ref->publication_date, val); break; - case 'P': strcpy(state.ref->page_number, val); break; - case 'G': strcpy(state.ref->gov_number, val); break; - case 'O': strcpy(state.ref->other, val); break; - case 'K': strcpy(state.ref->keywords, val); break; - case 'd': strcpy(state.ref->original_pub_date, val); break; - case 'a': strcpy(state.ref->additions, val); break; - case 't': strcpy(state.ref->reprint_title, val); break; - case 'l': strcpy(state.ref->translator, val); break; - case 'r': strcpy(state.ref->translator_editor, val); break; - case 's': strcpy(state.ref->site_name, val); break; - case 'c': strcpy(state.ref->site_content, val); break; - case 'o': strcpy(state.ref->organization, val); break; - case 'u': strcpy(state.ref->url, val); break; + case 'A': strncpy(state.ref->author, val, BUF_SIZE); break; + case 'T': strncpy(state.ref->title, val, BUF_SIZE); break; + case 'B': strncpy(state.ref->book_title, val, BUF_SIZE); break; + case 'R': strncpy(state.ref->report_number, val, BUF_SIZE); break; + case 'J': strncpy(state.ref->journal_name, val, BUF_SIZE); break; + case 'E': strncpy(state.ref->editor, val, BUF_SIZE); break; + case 'e': strncpy(state.ref->edition, val, BUF_SIZE); break; + case 'V': strncpy(state.ref->volume, val, BUF_SIZE); break; + case 'N': strncpy(state.ref->journal_number, val, BUF_SIZE); break; + case 'S': strncpy(state.ref->series, val, BUF_SIZE); break; + case 'C': strncpy(state.ref->city, val, BUF_SIZE); break; + case 'I': strncpy(state.ref->publisher, val, BUF_SIZE); break; + case 'D': strncpy(state.ref->publication_date, val, BUF_SIZE); break; + case 'P': strncpy(state.ref->page_number, val, BUF_SIZE); break; + case 'G': strncpy(state.ref->gov_number, val, BUF_SIZE); break; + case 'O': strncpy(state.ref->other, val, BUF_SIZE); break; + case 'K': strncpy(state.ref->keywords, val, BUF_SIZE); break; + case 'd': strncpy(state.ref->original_pub_date, val, BUF_SIZE); break; + case 'a': strncpy(state.ref->additions, val, BUF_SIZE); break; + case 't': strncpy(state.ref->reprint_title, val, BUF_SIZE); break; + case 'l': strncpy(state.ref->translator, val, BUF_SIZE); break; + case 'r': strncpy(state.ref->translator_editor, val, BUF_SIZE); break; + case 's': strncpy(state.ref->site_name, val, BUF_SIZE); break; + case 'c': strncpy(state.ref->site_content, val, BUF_SIZE); break; + case 'o': strncpy(state.ref->organization, val, BUF_SIZE); break; + case 'u': strncpy(state.ref->url, val, BUF_SIZE); break; } }