* SF Tracker [ 1652827 ] UpnpRegisterRootDevice returned -104

Submitted By: Michael Andersen - miwer

	Issue was found to be related to sizeof (size_t) != sizeof (int)
	on AMD64 systems. Emil Ljungdahl's AMD64 patch has been applied along
	with some other fixes. Original user report follows:

	When I run upnpd I get the above mentioned error (UPNP_E_OUTOF_MEMORY).
	I've tried with 1.4.1 and 1.4.2-RC3, it's the same. I don't understand why,
	because I have plenty of RAM, and I even tried closing some applications,
	but it didn't help.

	$ upnpd eth1 br0

	The following is logged in the /var/log/messages:
	Feb 6 01:33:47 server upnpd[6933]: Error registering the root device with
	descDocUrl: http://192.168.0.1:49152/gatedesc.xml
	Feb 6 01:33:47 server upnpd[6933]: UpnpRegisterRootDevice returned -104


	I tried enabling debugging and it looks like it cannot allocate memory
	through the membuffer_append function. It's wierd because it's only a few
	bytes.

	Please note, that I enabled some extra debugging lines that were commented,
	in order to get more information. See attached files.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@154 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
Marcelo Roberto Jimenez
2007-04-17 03:55:20 +00:00
parent 59e0e015be
commit 286a45d4ad
8 changed files with 59 additions and 34 deletions

View File

@@ -802,27 +802,30 @@ MakePostMessage( const char *url_str,
"HOSTNAME : %s Length : %d\n", hoststr, hostlen );
)
if( contentLength >= 0 ) {
if( contentLength >= 0 ) {
ret_code = http_MakeMessage(
request, 1, 1,
"QsbcDCUTNc",
"Q" "s" "bcDCU" "T" "Nc",
HTTPMETHOD_POST, url->pathquery.buff, url->pathquery.size,
"HOST: ", hoststr, hostlen,
"HOST: ",
hoststr, hostlen,
contentType,
(off_t)contentLength );
} else if( contentLength == UPNP_USING_CHUNKED ) {
ret_code = http_MakeMessage(
request, 1, 1,
"QsbcDCUTKc",
"Q" "s" "bcDCU" "TKc",
HTTPMETHOD_POST, url->pathquery.buff, url->pathquery.size,
"HOST: ", hoststr, hostlen,
"HOST: ",
hoststr, hostlen,
contentType );
} else if( contentLength == UPNP_UNTIL_CLOSE ) {
ret_code = http_MakeMessage(
request, 1, 1,
"QsbcDCUTc",
"Q" "s" "bcDCU" "Tc",
HTTPMETHOD_POST, url->pathquery.buff, url->pathquery.size,
"HOST: ", hoststr, hostlen,
"HOST: ",
hoststr, hostlen,
contentType );
} else {
ret_code = UPNP_E_INVALID_PARAM;
@@ -1816,7 +1819,7 @@ http_MakeMessage( INOUT membuffer * buf,
{
char c;
char *s = NULL;
int num;
size_t num;
off_t bignum;
size_t length;
time_t *loc_time;
@@ -1899,7 +1902,7 @@ http_MakeMessage( INOUT membuffer * buf,
{
num = ( int )va_arg( argp, int );
sprintf( tempbuf, "%d", num );
sprintf( tempbuf, "%zu", num );
if( membuffer_append( buf, tempbuf, strlen( tempbuf ) ) != 0 ) {
goto error_handler;
}
@@ -2047,7 +2050,7 @@ http_MakeMessage( INOUT membuffer * buf,
method = ( http_method_t ) va_arg( argp, http_method_t );
method_str = method_to_str( method );
url_str = ( const char * )va_arg( argp, const char * );
num = ( int )va_arg( argp, int ); // length of url_str
num = ( size_t )va_arg( argp, size_t ); // length of url_str
if (http_MakeMessage(
buf, http_major_version, http_minor_version,