1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-25 04:43:33 +00:00

Fix remote buffer overflow in search.cgi arguments

This commit is contained in:
Andrey A. Chernov 2001-04-20 08:48:51 +00:00
parent a1f6a30d25
commit 68c3bfdbb2
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=41698
6 changed files with 78 additions and 3 deletions

View File

@ -7,7 +7,7 @@
PORTNAME= mnogosearch
PORTVERSION= 3.1.12
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= www databases
MASTER_SITES= http://search.mnogo.ru/Download/

View File

@ -0,0 +1,25 @@
--- src/search.c.old Wed Feb 28 15:28:10 2001
+++ src/search.c Thu Apr 19 18:02:10 2001
@@ -1269,7 +1269,8 @@
strcpy(template,env);
if((env=getenv("QUERY_STRING"))){
- strcpy(query_string,env);
+ strncpy(query_string,env,UDMSTRSIZ-1);
+ query_string[UDMSTRSIZ-1] = '\0';
if((env=getenv("REDIRECT_STATUS"))){
/* Check Apache internal redirect */
@@ -1316,8 +1317,10 @@
/* or under server which do not */
/* pass an empty QUERY_STRING var */
- if(argv[1])
- sprintf(query_string,"q=%s",argv[1]);
+ if(argv[1]) {
+ strcpy(query_string, "q=");
+ strncat(query_string, argv[1], UDMSTRSIZ-1-2);
+ }
if(!template[0])
sprintf(template,"%s/%s", UDM_CONF_DIR,"search.htm");
}

View File

@ -7,7 +7,7 @@
PORTNAME= mnogosearch
PORTVERSION= 3.1.12
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= www databases
MASTER_SITES= http://search.mnogo.ru/Download/

View File

@ -0,0 +1,25 @@
--- src/search.c.old Wed Feb 28 15:28:10 2001
+++ src/search.c Thu Apr 19 18:02:10 2001
@@ -1269,7 +1269,8 @@
strcpy(template,env);
if((env=getenv("QUERY_STRING"))){
- strcpy(query_string,env);
+ strncpy(query_string,env,UDMSTRSIZ-1);
+ query_string[UDMSTRSIZ-1] = '\0';
if((env=getenv("REDIRECT_STATUS"))){
/* Check Apache internal redirect */
@@ -1316,8 +1317,10 @@
/* or under server which do not */
/* pass an empty QUERY_STRING var */
- if(argv[1])
- sprintf(query_string,"q=%s",argv[1]);
+ if(argv[1]) {
+ strcpy(query_string, "q=");
+ strncat(query_string, argv[1], UDMSTRSIZ-1-2);
+ }
if(!template[0])
sprintf(template,"%s/%s", UDM_CONF_DIR,"search.htm");
}

View File

@ -7,7 +7,7 @@
PORTNAME= mnogosearch
PORTVERSION= 3.1.12
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= www databases
MASTER_SITES= http://search.mnogo.ru/Download/

View File

@ -0,0 +1,25 @@
--- src/search.c.old Wed Feb 28 15:28:10 2001
+++ src/search.c Thu Apr 19 18:02:10 2001
@@ -1269,7 +1269,8 @@
strcpy(template,env);
if((env=getenv("QUERY_STRING"))){
- strcpy(query_string,env);
+ strncpy(query_string,env,UDMSTRSIZ-1);
+ query_string[UDMSTRSIZ-1] = '\0';
if((env=getenv("REDIRECT_STATUS"))){
/* Check Apache internal redirect */
@@ -1316,8 +1317,10 @@
/* or under server which do not */
/* pass an empty QUERY_STRING var */
- if(argv[1])
- sprintf(query_string,"q=%s",argv[1]);
+ if(argv[1]) {
+ strcpy(query_string, "q=");
+ strncat(query_string, argv[1], UDMSTRSIZ-1-2);
+ }
if(!template[0])
sprintf(template,"%s/%s", UDM_CONF_DIR,"search.htm");
}