summaryrefslogtreecommitdiff
path: root/modules/pam_timestamp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/pam_timestamp')
-rw-r--r--modules/pam_timestamp/hmacfile.c6
-rw-r--r--modules/pam_timestamp/pam_timestamp.c4
2 files changed, 6 insertions, 4 deletions
diff --git a/modules/pam_timestamp/hmacfile.c b/modules/pam_timestamp/hmacfile.c
index 7c1f8bfb..69d39afa 100644
--- a/modules/pam_timestamp/hmacfile.c
+++ b/modules/pam_timestamp/hmacfile.c
@@ -118,14 +118,16 @@ testvectors(void)
if (strncasecmp(hex,
vectors[i].hmac + 2 * j,
2) != 0) {
- printf("Incorrect result for vector %lu\n", i + 1);
+ printf("Incorrect result for vector %lu\n",
+ (unsigned long) i + 1);
exit(1);
}
}
free(hmac);
} else {
- printf("Error in vector %lu.\n", i + 1);
+ printf("Error in vector %lu.\n",
+ (unsigned long) i + 1);
exit(1);
}
}
diff --git a/modules/pam_timestamp/pam_timestamp.c b/modules/pam_timestamp/pam_timestamp.c
index 832aa629..d6a04a50 100644
--- a/modules/pam_timestamp/pam_timestamp.c
+++ b/modules/pam_timestamp/pam_timestamp.c
@@ -578,10 +578,10 @@ pam_sm_open_session(pam_handle_t *pamh, int flags UNUSED, int argc, const char *
/* Create the directory for the timestamp file if it doesn't already
* exist. */
- for (i = 1; path[i] != '\0'; i++) {
+ for (i = 1; i < (int) sizeof(path) && path[i] != '\0'; i++) {
if (path[i] == '/') {
/* Attempt to create the directory. */
- strncpy(subdir, path, i);
+ memcpy(subdir, path, i);
subdir[i] = '\0';
if (mkdir(subdir, 0700) == 0) {
/* Attempt to set the owner to the superuser. */