1 --- thttpd-2.25b/extras/htpasswd.c.orig 2006-03-31 04:12:42.281317000 +0000
2 +++ thttpd-2.25b/extras/htpasswd.c 2006-03-31 05:21:37.741632392 +0000
3 @@ -151,6 +151,7 @@ void interrupted(int signo) {
4 int main(int argc, char *argv[]) {
6 char user[MAX_STRING_LEN];
7 + char pwfilename[MAX_STRING_LEN];
8 char line[MAX_STRING_LEN];
9 char l[MAX_STRING_LEN];
10 char w[MAX_STRING_LEN];
11 @@ -168,6 +169,25 @@ int main(int argc, char *argv[]) {
15 + if (strlen(argv[2]) > (sizeof(pwfilename) - 1)) {
16 + fprintf(stderr, "%s: filename is too long\n", argv[0]);
19 + if (((strchr(argv[2], ';')) != NULL) || ((strchr(argv[2], '>')) != NULL)) {
20 + fprintf(stderr, "%s: filename contains an illegal character\n",
24 + if (strlen(argv[3]) > (sizeof(user) - 1)) {
25 + fprintf(stderr, "%s: username is too long\n", argv[0],
29 + if ((strchr(argv[3], ':')) != NULL) {
30 + fprintf(stderr, "%s: username contains an illegal character\n",
34 printf("Adding password for %s.\n",argv[3]);
35 add_password(argv[3],tfp);
37 @@ -180,6 +200,25 @@ int main(int argc, char *argv[]) {
41 + if (strlen(argv[1]) > (sizeof(pwfilename) - 1)) {
42 + fprintf(stderr, "%s: filename is too long\n", argv[0]);
45 + if (((strchr(argv[1], ';')) != NULL) || ((strchr(argv[1], '>')) != NULL)) {
46 + fprintf(stderr, "%s: filename contains an illegal character\n",
50 + if (strlen(argv[2]) > (sizeof(user) - 1)) {
51 + fprintf(stderr, "%s: username is too long\n", argv[0],
55 + if ((strchr(argv[2], ':')) != NULL) {
56 + fprintf(stderr, "%s: username contains an illegal character\n",
60 if(!(f = fopen(argv[1],"r"))) {
62 "Could not open passwd file %s for reading.\n",argv[1]);