aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libnpass/libnpass.c12
-rw-r--r--src/libnpass/util.c2
-rw-r--r--src/npass/npass.c2
3 files changed, 8 insertions, 8 deletions
diff --git a/src/libnpass/libnpass.c b/src/libnpass/libnpass.c
index b9ce58e..a918e77 100644
--- a/src/libnpass/libnpass.c
+++ b/src/libnpass/libnpass.c
@@ -46,14 +46,14 @@ int set_pass_dir(void) {
env = getenv("XDG_DATA_HOME");
if (env) {
- snprintf(pass_dir, sizeof(pass_dir) - 1, "%s/%s", env,
+ snprintf(pass_dir, sizeof(pass_dir), "%s/%s", env,
DEF_PASS_DIR);
return 0;
}
env = getenv("HOME");
if (env) {
- snprintf(pass_dir, sizeof(pass_dir) - 1, "%s/%s/%s", env,
+ snprintf(pass_dir, sizeof(pass_dir), "%s/%s/%s", env,
".local/share", DEF_PASS_DIR);
return 0;
}
@@ -104,7 +104,7 @@ pass_store_t pass_store_type(const char *spath) {
if (r)
err_ret(PASS_STORE_INV, "PASSWORD_STORE_DIR not set");
- r = snprintf(abs_path, sizeof(abs_path) - 1, "%s/%s",
+ r = snprintf(abs_path, sizeof(abs_path), "%s/%s",
pass_dir, (spath) ? spath : "");
if (r >= (int) sizeof(abs_path))
err_ret(PASS_STORE_INV, "path exceeded PATH_MAX");
@@ -112,7 +112,7 @@ pass_store_t pass_store_type(const char *spath) {
if (!r && (sbuf.st_mode & S_IFMT) == S_IFDIR)
return PASS_STORE_DIR;
- r = snprintf(abs_path, sizeof(abs_path) - 1, "%s/%s.gpg",
+ r = snprintf(abs_path, sizeof(abs_path), "%s/%s.gpg",
pass_dir, spath);
if (r >= (int) sizeof(abs_path))
err_ret(PASS_STORE_INV, "path exceeded PATH_MAX");
@@ -139,7 +139,7 @@ DIR *openstore(const char *spath) {
err_ret(NULL, "%s is not a passwordstore directory", spath);
if (spath) {
- r = snprintf(abs_path, sizeof(abs_path) - 1, "%s/%s",
+ r = snprintf(abs_path, sizeof(abs_path), "%s/%s",
pass_dir, spath);
if (r >= (int) sizeof(abs_path))
err_ret(NULL, "path exceeded PATH_MAX");
@@ -173,7 +173,7 @@ int readstore(DIR *dirp, struct store *s) {
return EOF;
}
- strncpy(s->name , dir->d_name, sizeof(s->name));
+ strncpy(s->name , dir->d_name, sizeof(s->name) - 1);
switch (dir->d_type) {
case DT_DIR:
s->type = PASS_STORE_DIR;
diff --git a/src/libnpass/util.c b/src/libnpass/util.c
index 11cf264..e2bbbff 100644
--- a/src/libnpass/util.c
+++ b/src/libnpass/util.c
@@ -16,7 +16,7 @@ int r_mkdir(const char *path, mode_t mode)
char *p;
char tmp[NAME_MAX + 1];
- strncpy(tmp, path, sizeof(tmp) - 1);
+ strncpy(tmp, path, sizeof(tmp));
len = strlen(tmp);
if(tmp[len - 1] == '/')
tmp[len - 1] = '\0';
diff --git a/src/npass/npass.c b/src/npass/npass.c
index 869b6eb..b328d01 100644
--- a/src/npass/npass.c
+++ b/src/npass/npass.c
@@ -95,7 +95,7 @@ int ls(const char *path, size_t depth, depth_state_t *depth_state) {
if (stor[i].type == PASS_STORE_DIR) {
printf("%s %s%s%s\n", prefix, BLUE, stor[i].name, NCOL);
- snprintf(new_path, sizeof(new_path) - 1, "%s/%s",
+ snprintf(new_path, sizeof(new_path), "%s/%s",
(path) ? path : "", stor[i].name);
ls(new_path, depth + 1, depth_state);
} else {