diff --git a/calmwm.c b/calmwm.c index afc5e18..9de4d43 100644 --- a/calmwm.c +++ b/calmwm.c @@ -18,13 +18,14 @@ * $OpenBSD$ */ -#include +#include #include "queue.h" #include #include #include #include +#include #include #include #include diff --git a/calmwm.h b/calmwm.h index 023c8f9..b56a9d7 100644 --- a/calmwm.h +++ b/calmwm.h @@ -279,7 +279,7 @@ TAILQ_HEAD(mousebinding_q, binding); struct cmd { TAILQ_ENTRY(cmd) entry; char *name; - char path[MAXPATHLEN]; + char path[PATH_MAX]; }; TAILQ_HEAD(cmd_q, cmd); @@ -311,7 +311,7 @@ struct conf { int snapdist; struct gap gap; char *color[CWM_COLOR_NITEMS]; - char known_hosts[MAXPATHLEN]; + char known_hosts[PATH_MAX]; #define CONF_FONT "sans-serif:pixelsize=14:bold" char *font; Cursor cursor[CF_NITEMS]; diff --git a/client.c b/client.c index 4697df5..d49dd34 100644 --- a/client.c +++ b/client.c @@ -18,12 +18,13 @@ * $OpenBSD$ */ -#include +#include #include "queue.h" #include #include #include +#include #include #include #include diff --git a/conf.c b/conf.c index 94c1773..ad9f24c 100644 --- a/conf.c +++ b/conf.c @@ -18,12 +18,13 @@ * $OpenBSD$ */ -#include +#include #include "queue.h" #include #include #include +#include #include #include #include diff --git a/group.c b/group.c index 93b253c..81fae63 100644 --- a/group.c +++ b/group.c @@ -19,12 +19,13 @@ * $OpenBSD$ */ -#include +#include #include "queue.h" #include #include #include +#include #include #include #include diff --git a/kbfunc.c b/kbfunc.c index afb0314..8ad5b99 100644 --- a/kbfunc.c +++ b/kbfunc.c @@ -18,12 +18,13 @@ * $OpenBSD$ */ -#include +#include #include "queue.h" #include #include #include +#include #include #include #include @@ -238,7 +239,7 @@ kbfunc_exec(struct client_ctx *cc, union arg *arg) #define NPATHS 256 struct screen_ctx *sc = cc->sc; char **ap, *paths[NPATHS], *path, *pathcpy; - char tpath[MAXPATHLEN]; + char tpath[PATH_MAX]; const char *label; DIR *dirp; struct dirent *dp; @@ -323,8 +324,8 @@ kbfunc_ssh(struct client_ctx *cc, union arg *arg) struct menu_q menuq; FILE *fp; char *buf, *lbuf, *p; - char hostbuf[MAXHOSTNAMELEN]; - char path[MAXPATHLEN]; + char hostbuf[HOST_NAME_MAX+1]; + char path[PATH_MAX]; int l; size_t len; diff --git a/menu.c b/menu.c index 0203b33..2faa734 100644 --- a/menu.c +++ b/menu.c @@ -19,12 +19,13 @@ * $OpenBSD$ */ -#include +#include #include "queue.h" #include #include #include +#include #include #include #include diff --git a/mousefunc.c b/mousefunc.c index 00348f3..0da19aa 100644 --- a/mousefunc.c +++ b/mousefunc.c @@ -19,11 +19,12 @@ * $OpenBSD$ */ -#include +#include #include "queue.h" #include #include +#include #include #include #include diff --git a/parse.y b/parse.y index d8fb0b5..eb8ed64 100644 --- a/parse.y +++ b/parse.y @@ -21,7 +21,7 @@ %{ -#include +#include #include #include @@ -49,7 +49,9 @@ struct file *pushfile(const char *); int popfile(void); int yyparse(void); int yylex(void); -int yyerror(const char *, ...); +int yyerror(const char *, ...) + __attribute__((__format__ (printf, 1, 2))) + __attribute__((__nonnull__ (1))); int kw_cmp(const void *, const void *); int lookup(char *); int lgetc(int); @@ -119,21 +121,21 @@ main : FONTNAME STRING { } | BORDERWIDTH NUMBER { if ($2 < 0 || $2 > UINT_MAX) { - yyerror("invalid borderwidth: %d", $2); + yyerror("invalid borderwidth: %lld", $2); YYERROR; } conf->bwidth = $2; } | MOVEAMOUNT NUMBER { if ($2 < 0 || $2 > INT_MAX) { - yyerror("invalid movemount: %d", $2); + yyerror("invalid movemount: %lld", $2); YYERROR; } conf->mamount = $2; } | SNAPDIST NUMBER { if ($2 < 0 || $2 > INT_MAX) { - yyerror("invalid snapdist: %d", $2); + yyerror("invalid snapdist: %lld", $2); YYERROR; } conf->snapdist = $2; @@ -151,7 +153,7 @@ main : FONTNAME STRING { | AUTOGROUP NUMBER STRING { if ($2 < 0 || $2 > 9) { free($3); - yyerror("invalid autogroup: %d", $2); + yyerror("invalid autogroup: %lld", $2); YYERROR; } conf_autogroup(conf, $2, $3); @@ -176,7 +178,7 @@ main : FONTNAME STRING { $3 < 0 || $3 > INT_MAX || $4 < 0 || $4 > INT_MAX || $5 < 0 || $5 > INT_MAX) { - yyerror("invalid gap: %d %d %d %d", + yyerror("invalid gap: %lld %lld %lld %lld", $2, $3, $4, $5); YYERROR; } @@ -438,6 +440,9 @@ yylex(void) } else if (c == quotec) { *p = '\0'; break; + } else if (c == '\0') { + yyerror("syntax error"); + return (findeol()); } if (p + 1 >= buf + sizeof(buf) - 1) { yyerror("string too long"); diff --git a/screen.c b/screen.c index f2b053e..e0aae1b 100644 --- a/screen.c +++ b/screen.c @@ -18,11 +18,12 @@ * $OpenBSD$ */ -#include +#include #include "queue.h" #include #include +#include #include #include #include diff --git a/search.c b/search.c index 49e3184..33f2838 100644 --- a/search.c +++ b/search.c @@ -18,7 +18,7 @@ * $OpenBSD$ */ -#include +#include #include "queue.h" #include @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -172,7 +173,7 @@ search_print_client(struct menu *mi, int list) static void search_match_path(struct menu_q *menuq, struct menu_q *resultq, char *search, int flag) { - char pattern[MAXPATHLEN]; + char pattern[PATH_MAX]; glob_t g; int i; diff --git a/util.c b/util.c index c175165..3b28ba1 100644 --- a/util.c +++ b/util.c @@ -18,11 +18,12 @@ * $OpenBSD$ */ -#include +#include #include "queue.h" #include #include +#include #include #include #include diff --git a/xevents.c b/xevents.c index 8facee1..df98b2d 100644 --- a/xevents.c +++ b/xevents.c @@ -24,11 +24,12 @@ * management of the xevent's. */ -#include +#include #include "queue.h" #include #include +#include #include #include #include diff --git a/xmalloc.c b/xmalloc.c index cb24c26..059d7b3 100644 --- a/xmalloc.c +++ b/xmalloc.c @@ -18,11 +18,12 @@ * $OpenBSD$ */ -#include +#include #include "queue.h" #include #include +#include #include #include #include diff --git a/xutil.c b/xutil.c index 460f902..71547a0 100644 --- a/xutil.c +++ b/xutil.c @@ -18,11 +18,12 @@ * $OpenBSD$ */ -#include +#include #include "queue.h" #include #include +#include #include #include #include