aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dzen.h2
-rw-r--r--main.c5
2 files changed, 5 insertions, 2 deletions
diff --git a/dzen.h b/dzen.h
index ad98e70..be82e44 100644
--- a/dzen.h
+++ b/dzen.h
@@ -96,7 +96,7 @@ struct DZEN {
Bool ispersistent;
Bool tsupdate;
unsigned long timeout;
- int cur_line;
+ long cur_line;
int ret_val;
/* should always be 0 if DZEN_XINERAMA not defined */
diff --git a/main.c b/main.c
index ae1782a..5986a3c 100644
--- a/main.c
+++ b/main.c
@@ -98,7 +98,7 @@ chomp(char *inbuf, char *outbuf, int start, int len) {
free(rem);
rem = NULL;
}
- while(off < len) {
+ while((off < len) && (off < MAX_LINE_LEN)) {
if(inbuf[off] != '\n') {
outbuf[i++] = inbuf[off++];
} else if(inbuf[off] == '\n') {
@@ -107,6 +107,9 @@ chomp(char *inbuf, char *outbuf, int start, int len) {
}
}
+ if(off >= MAX_LINE_LEN)
+ return 0;
+
outbuf[i] = '\0';
rem = estrdup(outbuf);
return 0;