diff options
author | Dominique Martinet <asmadeus@codewreck.org> | 2018-04-05 13:58:23 +0900 |
---|---|---|
committer | Dominique Martinet <asmadeus@codewreck.org> | 2018-04-13 14:37:53 +0900 |
commit | 555206cf6041c0ab8c83f3a9860cd794a7be255c (patch) | |
tree | e7b3d316008d1cda7c6863a9c2aa0780a70b9f6c /examples/support/config.c | |
parent | 99b92b4104bf7bdd7663289c71f6cf0933e16a0f (diff) |
Fix gcc string truncation warnings
Diffstat (limited to 'examples/support/config.c')
-rw-r--r-- | examples/support/config.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/examples/support/config.c b/examples/support/config.c index f0efa594..319be31a 100644 --- a/examples/support/config.c +++ b/examples/support/config.c @@ -202,7 +202,10 @@ struct example_config *parse_args(int argc, char *argv[]) { char cwd[MAXPATHLEN]; if (getcwd(cwd, sizeof(cwd)) != NULL) { char buf[MAXPATHLEN]; - snprintf(buf, MAXPATHLEN, "%s/%s", cwd, "wlr-example.ini"); + if (snprintf(buf, MAXPATHLEN, "%s/%s", cwd, "wlr-example.ini") >= MAXPATHLEN) { + wlr_log(L_ERROR, "config path too long"); + exit(1); + } config->config_path = strdup(buf); } else { wlr_log(L_ERROR, "could not get cwd"); |