thttpd/thttpd-2.25b-overflow.diff
Marguerite Su aaa8c68bda Accepting request 643659 from home:vitezslav_cizek:branches:server:http
- Update to 2.29 (bsc#1112629)
  Allow CGI to handle HTTP methods besides GET/HEAD/POST.
  Improvements to the FreeBSD startup script. (Craig Leres)
  Minor portability tweak in mmc.c.
  Fix to buffer overrun bug in htpasswd. Reported by Alessio Santoru as CVE-2017-17663.
- update thttpd-2.25b-overflow.diff

OBS-URL: https://build.opensuse.org/request/show/643659
OBS-URL: https://build.opensuse.org/package/show/server:http/thttpd?expand=0&rev=41
2018-10-23 12:47:01 +00:00

25 lines
850 B
Diff

Index: extras/htpasswd.c
===================================================================
--- extras/htpasswd.c.orig 2018-10-22 10:48:47.811465609 +0200
+++ extras/htpasswd.c 2018-10-22 10:52:45.008744706 +0200
@@ -193,7 +193,8 @@ int main(int argc, char *argv[]) {
putline(tfp,line);
continue;
}
- strcpy(l,line);
+ strncpy(l,line,MAX_STRING_LEN);
+ l[MAX_STRING_LEN-1]='\0';
getword(w,l,':');
if(strcmp(user,w)) {
putline(tfp,line);
@@ -211,7 +212,8 @@ int main(int argc, char *argv[]) {
}
fclose(f);
fclose(tfp);
- sprintf(command,"cp %s %s",temp_template,argv[1]);
+ snprintf(command,MAX_STRING_LEN,"cp %s %s",temp_template,argv[1]);
+ command[MAX_STRING_LEN-1]='\0';
system(command);
unlink(temp_template);
exit(0);