diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-04-13 08:31:09 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-13 08:31:09 -0400 |
commit | 4dbf7f8b8832bb16940527c18765131f7bbf83b2 (patch) | |
tree | 262b21eac2b3c06047d697a81bd899ddcf09ed4b /rootston/config.c | |
parent | 65903d26775789608bb336ecde03259e94b3a6d7 (diff) | |
parent | 555206cf6041c0ab8c83f3a9860cd794a7be255c (diff) |
Merge pull request #865 from martinetd/str_truncation
Fix gcc string truncation warnings
Diffstat (limited to 'rootston/config.c')
-rw-r--r-- | rootston/config.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/rootston/config.c b/rootston/config.c index 0883f6d4..67bf83e9 100644 --- a/rootston/config.c +++ b/rootston/config.c @@ -418,7 +418,10 @@ struct roots_config *roots_config_create_from_args(int argc, char *argv[]) { char cwd[MAXPATHLEN]; if (getcwd(cwd, sizeof(cwd)) != NULL) { char buf[MAXPATHLEN]; - snprintf(buf, MAXPATHLEN, "%s/%s", cwd, "rootston.ini"); + if (snprintf(buf, MAXPATHLEN, "%s/%s", cwd, "rootston.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"); |