summaryrefslogtreecommitdiffstats
path: root/libcsoap/soap-env.c
diff options
context:
space:
mode:
authorGravatar mrcsys2006-01-27 20:23:39 +0000
committerGravatar mrcsys2006-01-27 20:23:39 +0000
commit313e3f2e656110cd4b67d526df04d9cb3afee1e7 (patch)
treef8d5308f28ab185406cce0785aeea8c110eb9b6e /libcsoap/soap-env.c
parentd2de034d35e290f68e25f33f19e5e11f5baddeca (diff)
downloadcsoap-313e3f2e656110cd4b67d526df04d9cb3afee1e7.tar.gz
csoap-313e3f2e656110cd4b67d526df04d9cb3afee1e7.tar.bz2
Fixed two buffer overflow problems.
This results in different deffinitions for soap_env_find_urn() and soap_env_find_methodname()
Diffstat (limited to 'libcsoap/soap-env.c')
-rw-r--r--libcsoap/soap-env.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/libcsoap/soap-env.c b/libcsoap/soap-env.c
index 9b83abc..8252961 100644
--- a/libcsoap/soap-env.c
+++ b/libcsoap/soap-env.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-env.c,v 1.13 2006/01/25 18:12:06 mrcsys Exp $
+* $Id: soap-env.c,v 1.14 2006/01/27 20:23:39 mrcsys Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -195,9 +195,9 @@ soap_env_new_with_fault(fault_code_t faultcode,
herror_t
soap_env_new_with_response(SoapEnv * request, SoapEnv ** out)
{
- char urn[100];
- char methodname[150];
- char methodname2[150];
+ char *urn;
+ char *methodname;
+ char *methodname2;
if (request == NULL)
{
@@ -212,7 +212,7 @@ soap_env_new_with_response(SoapEnv * request, SoapEnv ** out)
"request (first param) has no xml structure");
}
- if (!soap_env_find_methodname(request, methodname))
+ if (!(methodname = soap_env_find_methodname(request)))
{
return herror_new("soap_env_new_with_response",
GENERAL_INVALID_PARAM,
@@ -220,14 +220,15 @@ soap_env_new_with_response(SoapEnv * request, SoapEnv ** out)
SAVE_STR(methodname));
}
- if (!soap_env_find_urn(request, urn))
+ if (!(urn = soap_env_find_urn(request)))
{
/* here we have no chance to find out the namespace */
/* try to continue without namespace (urn) */
- urn[0] = '\0';
+ urn = "";
}
+ methodname2 = malloc(strlen(methodname)+9);
sprintf(methodname2, "%sResponse", methodname);
return soap_env_new_with_method(urn, methodname2, out);
}
@@ -569,8 +570,8 @@ _soap_env_get_body(SoapEnv * env)
}
-int
-soap_env_find_urn(SoapEnv * env, char *urn)
+char *
+soap_env_find_urn(SoapEnv * env)
{
xmlNsPtr ns;
xmlNodePtr body, node;
@@ -597,23 +598,22 @@ soap_env_find_urn(SoapEnv * env, char *urn)
ns = xmlSearchNs(body->doc, node, node->ns->prefix);
if (ns != NULL)
{
- strcpy(urn, (char *) ns->href);
- return 1; /* namespace found! */
+ return((char *) ns->href); /* namespace found! */
}
}
else
{
- strcpy(urn, "");
+ static char *empty = "";
log_warn1("No namespace found");
- return 1;
+ return(empty);
}
return 0;
}
-int
-soap_env_find_methodname(SoapEnv * env, char *method)
+char *
+soap_env_find_methodname(SoapEnv * env)
{
xmlNodePtr body, node;
@@ -636,9 +636,8 @@ soap_env_find_methodname(SoapEnv * env, char *method)
}
- strcpy(method, (const char *) node->name);
+ return((char *) node->name);
- return 1;
}