diff options
author | Pierre Neidhardt <ambrevar@gmail.com> | 2015-11-02 14:00:32 +0100 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2015-11-03 05:41:25 +0100 |
commit | d5b0f0c26f5dc139c5c8e534cafc017956229f66 (patch) | |
tree | 327b350fa27aa984061d47ad8f784d90e2542670 /src | |
parent | 906dc0ce24d62284b6a3caf612948553e7ffceb3 (diff) | |
download | pacman-d5b0f0c26f5dc139c5c8e534cafc017956229f66.tar.gz pacman-d5b0f0c26f5dc139c5c8e534cafc017956229f66.tar.xz |
package.c: Fix incorrect buffersize and constant-folding
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/pacman/package.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/pacman/package.c b/src/pacman/package.c index dbd23f5a..c9301acf 100644 --- a/src/pacman/package.c +++ b/src/pacman/package.c @@ -90,9 +90,8 @@ static void make_aligned_titles(void) { unsigned int i; size_t max = 0; - static const wchar_t *title_suffix = L" :"; - static const size_t title_suffix_len = sizeof(title_suffix); - wchar_t wbuf[ARRAYSIZE(titles)][TITLE_MAXLEN + title_suffix_len]; + static const wchar_t title_suffix[] = L" :"; + wchar_t wbuf[ARRAYSIZE(titles)][TITLE_MAXLEN + ARRAYSIZE(title_suffix)]; size_t wlen[ARRAYSIZE(wbuf)]; char *buf[ARRAYSIZE(wbuf)]; buf[T_ARCHITECTURE] = _("Architecture"); @@ -133,7 +132,7 @@ static void make_aligned_titles(void) for(i = 0; i < ARRAYSIZE(wbuf); i++) { wmemset(wbuf[i] + wlen[i], L' ', max - wlen[i]); - wmemcpy(wbuf[i] + max, title_suffix, title_suffix_len); + wmemcpy(wbuf[i] + max, title_suffix, ARRAYSIZE(title_suffix)); wcstombs(titles[i], wbuf[i], sizeof(wbuf[i])); } } |