Группа :: Система/Серверы
Пакет: apache
Главная Изменения Спек Патчи Загрузить Bugs and FR
Патч: apache-1.3.33-fix-htpasswd-buffer.patch
diff -Naur apache_1.3.33-orig/src/support/htpasswd.c apache_1.3.33/src/support/htpasswd.c
--- apache_1.3.33-orig/src/support/htpasswd.c 2004-02-21 00:02:24 +0200
+++ apache_1.3.33/src/support/htpasswd.c 2004-11-02 21:01:55 +0200
@@ -202,9 +202,9 @@
ap_cpystrn(record, "resultant record too long", (rlen - 1));
return ERR_OVERFLOW;
}
- strcpy(record, user);
+ strncpy(record, user,MAX_STRING_LEN - 1);
strcat(record, ":");
- strcat(record, cpw);
+ strncat(record, cpw,MAX_STRING_LEN - 1);
return 0;
}
@@ -410,14 +410,14 @@
fprintf(stderr, "%s: filename too long\n", argv[0]);
return ERR_OVERFLOW;
}
- strcpy(pwfilename, argv[i]);
+ strncpy(pwfilename, argv[i], MAX_STRING_LEN-1);
if (strlen(argv[i + 1]) > (sizeof(user) - 1)) {
fprintf(stderr, "%s: username too long (>%lu)\n", argv[0],
(unsigned long)(sizeof(user) - 1));
return ERR_OVERFLOW;
}
}
- strcpy(user, argv[i + 1]);
+ strncpy(user, argv[i + 1],MAX_STRING_LEN-1);
if ((arg = strchr(user, ':')) != NULL) {
fprintf(stderr, "%s: username contains illegal character '%c'\n",
argv[0], *arg);
@@ -429,7 +429,7 @@
(unsigned long)(sizeof(password) - 1));
return ERR_OVERFLOW;
}
- strcpy(password, argv[i + 2]);
+ strncpy(password, argv[i + 2],MAX_STRING_LEN - 1 );
}
#ifdef WIN32
@@ -553,7 +553,7 @@
putline(ftemp, line);
continue;
}
- strcpy(scratch, line);
+ strncpy(scratch, line,MAX_STRING_LEN -1);
/*
* See if this is our user.
*/