summaryrefslogtreecommitdiffstats
path: root/usr.sbin/httpd/src
diff options
context:
space:
mode:
authorhenning <henning@openbsd.org>2003-04-08 17:18:49 +0000
committerhenning <henning@openbsd.org>2003-04-08 17:18:49 +0000
commit813e9d20240ed20a60140a0ae55db8bfc29cbefc (patch)
treef0d53b8eb2f059b7f6b85edfcb2a833d0bce70e2 /usr.sbin/httpd/src
parentmore string shitz (diff)
downloadwireguard-openbsd-813e9d20240ed20a60140a0ae55db8bfc29cbefc.tar.xz
wireguard-openbsd-813e9d20240ed20a60140a0ae55db8bfc29cbefc.zip
string shit, ok pval@
Diffstat (limited to 'usr.sbin/httpd/src')
-rw-r--r--usr.sbin/httpd/src/support/htdigest.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/usr.sbin/httpd/src/support/htdigest.c b/usr.sbin/httpd/src/support/htdigest.c
index 319d02bb95f..641ba7a4363 100644
--- a/usr.sbin/httpd/src/support/htdigest.c
+++ b/usr.sbin/httpd/src/support/htdigest.c
@@ -166,7 +166,7 @@ static void add_password(char *user, char *realm, FILE *f)
fprintf(f, "%s:%s:", user, realm);
/* Do MD5 stuff */
- sprintf(string, "%s:%s:%s", user, realm, pw);
+ snprintf(string, sizeof(string), "%s:%s:%s", user, realm, pw);
ap_MD5Init(&context);
ap_MD5Update(&context, (unsigned char *) string, strlen(string));
@@ -241,7 +241,7 @@ int main(int argc, char *argv[])
else if (argc != 4)
usage();
- strcpy(tn, "/tmp/htdigest-XXXXXX");
+ strlcpy(tn, "/tmp/htdigest-XXXXXX", sizeof(tn));
tfd = mkstemp(tn);
if (tfd == -1 || (tfp = fdopen(tfd, "w")) == NULL) {
fprintf(stderr, "Could not create temp file.\n");
@@ -254,8 +254,8 @@ int main(int argc, char *argv[])
fprintf(stderr, "Use -c option to create new one.\n");
exit(1);
}
- strcpy(user, argv[3]);
- strcpy(realm, argv[2]);
+ strlcpy(user, argv[3], sizeof(user));
+ strlcpy(realm, argv[2], sizeof(realm));
found = 0;
while (!(getline(line, MAX_STRING_LEN, f))) {
@@ -263,7 +263,7 @@ int main(int argc, char *argv[])
putline(tfp, line);
continue;
}
- strcpy(l, line);
+ strlcpy(l, line, sizeof(l));
getword(w, l, ':');
getword(x, l, ':');
if (strcmp(user, w) || strcmp(realm, x)) {
@@ -284,9 +284,9 @@ int main(int argc, char *argv[])
fclose(tfp);
#ifndef NETWARE
#if defined(OS2) || defined(WIN32)
- sprintf(command, "copy \"%s\" \"%s\"", tn, argv[1]);
+ snprintf(command, sizeof(command), "copy \"%s\" \"%s\"", tn, argv[1]);
#else
- sprintf(command, "cp %s %s", tn, argv[1]);
+ snprintf(command, sizeof(command), "cp %s %s", tn, argv[1]);
#endif
system(command);
#else