From 9b222e23e9f5c53abe282c02ca5c4893f7b09eb4 Mon Sep 17 00:00:00 2001 From: Phil Date: Sat, 22 Mar 2008 18:18:25 +0000 Subject: [PATCH] hopefully fix spaced_print * when printing only width bytes to buf, with width being set to pad_percents which itself is set by the user to zero, nothing is printed * in the unlikely (but possible) case of width > size, this could lead to a segfault git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1029 7f574dfc-610e-0410-a909-a81674777703 --- src/conky.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/conky.c b/src/conky.c index 60bbc84c..c72c0f77 100644 --- a/src/conky.c +++ b/src/conky.c @@ -988,10 +988,10 @@ static int spaced_print(char *buf, int size, char *format, int width, len = snprintf(buf, size, "%s", tempbuf); break; case LEFT_SPACER: - len = snprintf(buf, width, "%*s", width - 1, tempbuf); + len = snprintf(buf, size, "%*s", width - 1, tempbuf); break; case RIGHT_SPACER: - len = snprintf(buf, width, "%-*s", width - 1, tempbuf); + len = snprintf(buf, size, "%-*s", width - 1, tempbuf); break; default: CRIT_ERR("%s encountered invalid use_spacer value (%d)", func_name,