|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
sfcc-interface.cIn sfcc-interface.c, in cim_put_instance(), the following code looks suspect:
if (objectpath != NULL) { cim_add_keys(objectpath, client->selectors); if (!objectpath) { goto cleanup; } } Once the code passes the check for objectpath != NULL, it cannot be NULL inside the if loop. The attached diff changes the code to: if (objectpath != NULL) { cim_add_keys(objectpath, client->selectors); } else{ goto cleanup; } -- Regards, Suresh ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Openwsman-devel mailing list Openwsman-devel@... https://lists.sourceforge.net/lists/listinfo/openwsman-devel |
|
|
Re: sfcc-interface.cHi Suresh,
* Suresh Sundriyal <ssundriy@...> [Oct 07. 2009 02:42]: > In sfcc-interface.c, in cim_put_instance(), the following code looks suspect: > > if (objectpath != NULL) { > cim_add_keys(objectpath, client->selectors); > if (!objectpath) { > goto cleanup; > } > } > > Once the code passes the check for objectpath != NULL, it cannot be NULL > inside the if loop. After looking at this part of the code more closely, I adapted your patch trying to catch more issues. See attachment. Submitted as rev 3269. Klaus --- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) Index: sfcc-interface.c =================================================================== --- sfcc-interface.c (revision 3257) +++ sfcc-interface.c (working copy) @@ -1782,7 +1782,12 @@ wsman_status_init(&statusP); objectpath = newCMPIObjectPath(client->cim_namespace, client->requested_class, NULL); - if(fragstr == NULL) { + if (!objectpath) { + status->fault_code = WXF_INVALID_REPRESENTATION; + status->fault_detail_code = WSMAN_DETAIL_INVALID_NAMESPACE; + goto cleanup; + } + if (fragstr == NULL) { resource = ws_xml_get_child(in_body, 0, client->resource_uri, client->requested_class); } @@ -1795,21 +1800,19 @@ goto cleanup; } - if (objectpath != NULL) { - cim_add_keys(objectpath, client->selectors); - if (!objectpath) { - goto cleanup; - } - } + cim_add_keys(objectpath, client->selectors); instance = newCMPIInstance(objectpath, NULL); - if (!instance) + if (!instance) { + status->fault_code = WXF_INVALID_REPRESENTATION; + status->fault_detail_code = WSMAN_DETAIL_INVALID_NAMESPACE; goto cleanup; + } class = cim_get_class(client, client->requested_class, CMPI_FLAG_IncludeQualifiers, status); - if (class ) { + if (class) { create_instance_from_xml(instance, class, resource, fragstr, client->resource_uri, status); CMRelease(class); @@ -1827,8 +1830,7 @@ cim_to_wsman_status(rc, status); } if (rc.rc == 0) { - if (instance) - instance2xml(client, instance, fragstr, body, NULL); + instance2xml(client, instance, fragstr, body, NULL); } if (rc.msg) CMRelease(rc.msg); ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Openwsman-devel mailing list Openwsman-devel@... https://lists.sourceforge.net/lists/listinfo/openwsman-devel |
|
|
Re: sfcc-interface.cHi Klaus,
Your changes look perfect. However, I just glanced through the code for SFCC and it seems like both newCMPIObjectPath and newCMPIInstance do a calloc to allocate space and the SFCC code never checks for the return value from the calloc nor checks the errno (I'm not sure if calloc sets an errno or not) and starts dereferencing the pointer, so I guess Openwsman is going to crash if either of those allocations fail due to memory constraints. :-) I'll spend some time with SFCC code and see if I can send the SBLIM project a patch for that. BTW, would you ( or anyone on the list) happen to have an idea whether the test plugins in the src/plugins/wsman are required for any intrinsic operations in Openwsman or they are there for unit testing purposes only? I'm trying to get the memory footprint of Openwsman down as low as possible and if they are just for testing then maybe I could remove them from the final product? -- Suresh ________________________________________ From: Klaus Kaempf [kkaempf@...] Sent: Tuesday, October 06, 2009 11:44 PM To: Suresh Sundriyal Cc: openwsman-devel@... Subject: Re: sfcc-interface.c Hi Suresh, * Suresh Sundriyal <ssundriy@...> [Oct 07. 2009 02:42]: > In sfcc-interface.c, in cim_put_instance(), the following code looks suspect: > > if (objectpath != NULL) { > cim_add_keys(objectpath, client->selectors); > if (!objectpath) { > goto cleanup; > } > } > > Once the code passes the check for objectpath != NULL, it cannot be NULL > inside the if loop. thanks, good catch ! After looking at this part of the code more closely, I adapted your patch trying to catch more issues. See attachment. Submitted as rev 3269. Klaus --- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Openwsman-devel mailing list Openwsman-devel@... https://lists.sourceforge.net/lists/listinfo/openwsman-devel |
|
|
segfault in u_strdupHi,
While testing 2.2.0, I ran into a segmentation fault that points to u_strdup in src/lib/u/misc.c. The fault comes from strlen when the string parameter to the u_strdup function is NULL. A NULL check can prevent the fault. A patch is attached. Thanks, -Chris Poblete ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Openwsman-devel mailing list Openwsman-devel@... https://lists.sourceforge.net/lists/listinfo/openwsman-devel |
|
|
Re: segfault in u_strdupChris,
* Chris_Poblete@... <Chris_Poblete@...> [Oct 08. 2009 22:41]: > Hi, > > While testing 2.2.0, I ran into a segmentation fault that points to > u_strdup in src/lib/u/misc.c. The fault comes from strlen when the > string parameter to the u_strdup function is NULL. A NULL check can > prevent the fault. A patch is attached. thanks for your patch. However, looking at src/lib/u/misc.c, almost none of the functions operating on string pointers check for NULL. In the specific case of u_strdup(), returning NULL from this function indicates a memory allocation problem. I'd rather fix the issue of passing NULL pointers at its root cause. From where was u_strdup() called in your case ? Klaus --- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Openwsman-devel mailing list Openwsman-devel@... https://lists.sourceforge.net/lists/listinfo/openwsman-devel |
|
|
Re: segfault in u_strdupHi Klaus,
Recreated the segfault and attached the segfault below. Although most peer functions do not check for NULL, it seems logical for u_strdup to check and return NULL when the source is NULL. The check could definitely be done from the caller but all callers (~180) would need to add the check for stability. Program terminated with signal 11, Segmentation fault. #0 0x0f62705c in strlen () from /lib/libc.so.6 (gdb) where #0 0x0f62705c in strlen () from /lib/libc.so.6 #1 0x0e938238 in u_strdup (s=0x0) at u/misc.c:143 #2 0x0e94ff20 in create_enum_info (op=0x1023a5e0, epcntx=0x1023dfd0, indoc=0x10228e18, eInfo=0x7fb1e5a0) at wsman-soap.c:240 #3 0x0e95207c in wsenum_enumerate_stub (op=0x1023a5e0, appData=0xe1606f0, opaqueData=0x0) at wsman-soap.c:953 #4 0x0e94e10c in process_inbound_operation (op=0x1023a5e0, msg=0x1023b7d0, opaqueData=0x0) at wsman-dispatcher.c:724 #5 0x0e94e4f0 in dispatch_inbound_call (soap=0x102266e0, msg=0x1023b7d0, opaqueData=0x0) at wsman-dispatcher.c:805 #6 0x0e8d9e04 in wsman_server_get_response () from /usr/local/wsman/lib/libwsman_server.so.1 Thanks, -Chris Poblete -----Original Message----- From: Klaus Kaempf [mailto:kkaempf@...] Sent: Friday, October 09, 2009 2:28 AM To: Poblete, Chris Cc: openwsman-devel@... Subject: Re: [Openwsman-devel] segfault in u_strdup Chris, * Chris_Poblete@... <Chris_Poblete@...> [Oct 08. 2009 22:41]: > Hi, > > While testing 2.2.0, I ran into a segmentation fault that points to > u_strdup in src/lib/u/misc.c. The fault comes from strlen when the > string parameter to the u_strdup function is NULL. A NULL check can > prevent the fault. A patch is attached. thanks for your patch. However, looking at src/lib/u/misc.c, almost none of the functions operating on string pointers check for NULL. In the specific case of u_strdup(), returning NULL from this function indicates a memory allocation problem. I'd rather fix the issue of passing NULL pointers at its root cause. From where was u_strdup() called in your case ? Klaus --- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Openwsman-devel mailing list Openwsman-devel@... https://lists.sourceforge.net/lists/listinfo/openwsman-devel |
|
|
Re: segfault in u_strdupThat's odd. Line 240 from wsman-soap.c reads:
enumInfo->encoding = u_strdup(msg->charset); I thought the problem of msg->charset being null was solved with changeset 3251. Would it be possible for you to check and see if you have that changeset in your source? Specifically check to see if the method get_request_encoding() in src/server/wsmand-listener.c has the variable char *encoding set to NULL or "UTF-8" at the time of declaration. Would it also be possible for you to send the SOAP request along with the HTTP headers? -- Suresh -----Original Message----- From: Chris_Poblete@... [mailto:Chris_Poblete@...] Sent: Friday, October 09, 2009 12:02 PM To: kkaempf@... Cc: openwsman-devel@... Subject: Re: [Openwsman-devel] segfault in u_strdup Hi Klaus, Recreated the segfault and attached the segfault below. Although most peer functions do not check for NULL, it seems logical for u_strdup to check and return NULL when the source is NULL. The check could definitely be done from the caller but all callers (~180) would need to add the check for stability. Program terminated with signal 11, Segmentation fault. #0 0x0f62705c in strlen () from /lib/libc.so.6 (gdb) where #0 0x0f62705c in strlen () from /lib/libc.so.6 #1 0x0e938238 in u_strdup (s=0x0) at u/misc.c:143 #2 0x0e94ff20 in create_enum_info (op=0x1023a5e0, epcntx=0x1023dfd0, indoc=0x10228e18, eInfo=0x7fb1e5a0) at wsman-soap.c:240 #3 0x0e95207c in wsenum_enumerate_stub (op=0x1023a5e0, appData=0xe1606f0, opaqueData=0x0) at wsman-soap.c:953 #4 0x0e94e10c in process_inbound_operation (op=0x1023a5e0, msg=0x1023b7d0, opaqueData=0x0) at wsman-dispatcher.c:724 #5 0x0e94e4f0 in dispatch_inbound_call (soap=0x102266e0, msg=0x1023b7d0, opaqueData=0x0) at wsman-dispatcher.c:805 #6 0x0e8d9e04 in wsman_server_get_response () from /usr/local/wsman/lib/libwsman_server.so.1 Thanks, -Chris Poblete -----Original Message----- From: Klaus Kaempf [mailto:kkaempf@...] Sent: Friday, October 09, 2009 2:28 AM To: Poblete, Chris Cc: openwsman-devel@... Subject: Re: [Openwsman-devel] segfault in u_strdup Chris, * Chris_Poblete@... <Chris_Poblete@...> [Oct 08. 2009 22:41]: > Hi, > > While testing 2.2.0, I ran into a segmentation fault that points to > u_strdup in src/lib/u/misc.c. The fault comes from strlen when the > string parameter to the u_strdup function is NULL. A NULL check can > prevent the fault. A patch is attached. thanks for your patch. However, looking at src/lib/u/misc.c, almost none of the functions operating on string pointers check for NULL. In the specific case of u_strdup(), returning NULL from this function indicates a memory allocation problem. I'd rather fix the issue of passing NULL pointers at its root cause. From where was u_strdup() called in your case ? Klaus --- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Openwsman-devel mailing list Openwsman-devel@... https://lists.sourceforge.net/lists/listinfo/openwsman-devel ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Openwsman-devel mailing list Openwsman-devel@... https://lists.sourceforge.net/lists/listinfo/openwsman-devel |
|
|
Re: segfault in u_strdupHere's a snapshot of the function:
char *get_request_encoding(struct shttpd_arg *arg) { const char *content_type; char *p; char *encoding = "UTF-8"; content_type = shttpd_get_header(arg, "Content-Type"); if(content_type ) { if(( p = strstr(content_type, "charset")) != NULL ) { p += strlen("charset"); p++; encoding = p; } } return encoding; } Here's the header info from the log: Content-Type: application/soap+xml;charset=UTF-8 User-Agent: openwsman 2.1.0 Content-Length: 1317 I'm using the 2.2.0 tar ball downloaded 10/6. Thanks, -Chris Poblete -----Original Message----- From: Suresh Sundriyal [mailto:ssundriy@...] Sent: Friday, October 09, 2009 3:16 PM To: Poblete, Chris; kkaempf@... Cc: openwsman-devel@... Subject: RE: [Openwsman-devel] segfault in u_strdup That's odd. Line 240 from wsman-soap.c reads: enumInfo->encoding = u_strdup(msg->charset); I thought the problem of msg->charset being null was solved with changeset 3251. Would it be possible for you to check and see if you have that changeset in your source? Specifically check to see if the method get_request_encoding() in src/server/wsmand-listener.c has the variable char *encoding set to NULL or "UTF-8" at the time of declaration. Would it also be possible for you to send the SOAP request along with the HTTP headers? -- Suresh -----Original Message----- From: Chris_Poblete@... [mailto:Chris_Poblete@...] Sent: Friday, October 09, 2009 12:02 PM To: kkaempf@... Cc: openwsman-devel@... Subject: Re: [Openwsman-devel] segfault in u_strdup Hi Klaus, Recreated the segfault and attached the segfault below. Although most peer functions do not check for NULL, it seems logical for u_strdup to check and return NULL when the source is NULL. The check could definitely be done from the caller but all callers (~180) would need to add the check for stability. Program terminated with signal 11, Segmentation fault. #0 0x0f62705c in strlen () from /lib/libc.so.6 (gdb) where #0 0x0f62705c in strlen () from /lib/libc.so.6 #1 0x0e938238 in u_strdup (s=0x0) at u/misc.c:143 #2 0x0e94ff20 in create_enum_info (op=0x1023a5e0, epcntx=0x1023dfd0, indoc=0x10228e18, eInfo=0x7fb1e5a0) at wsman-soap.c:240 #3 0x0e95207c in wsenum_enumerate_stub (op=0x1023a5e0, appData=0xe1606f0, opaqueData=0x0) at wsman-soap.c:953 #4 0x0e94e10c in process_inbound_operation (op=0x1023a5e0, msg=0x1023b7d0, opaqueData=0x0) at wsman-dispatcher.c:724 #5 0x0e94e4f0 in dispatch_inbound_call (soap=0x102266e0, msg=0x1023b7d0, opaqueData=0x0) at wsman-dispatcher.c:805 #6 0x0e8d9e04 in wsman_server_get_response () from /usr/local/wsman/lib/libwsman_server.so.1 Thanks, -Chris Poblete -----Original Message----- From: Klaus Kaempf [mailto:kkaempf@...] Sent: Friday, October 09, 2009 2:28 AM To: Poblete, Chris Cc: openwsman-devel@... Subject: Re: [Openwsman-devel] segfault in u_strdup Chris, * Chris_Poblete@... <Chris_Poblete@...> [Oct 08. 2009 22:41]: > Hi, > > While testing 2.2.0, I ran into a segmentation fault that points to > u_strdup in src/lib/u/misc.c. The fault comes from strlen when the > string parameter to the u_strdup function is NULL. A NULL check can > prevent the fault. A patch is attached. thanks for your patch. However, looking at src/lib/u/misc.c, almost none of the functions operating on string pointers check for NULL. In the specific case of u_strdup(), returning NULL from this function indicates a memory allocation problem. I'd rather fix the issue of passing NULL pointers at its root cause. From where was u_strdup() called in your case ? Klaus --- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Openwsman-devel mailing list Openwsman-devel@... https://lists.sourceforge.net/lists/listinfo/openwsman-devel ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Openwsman-devel mailing list Openwsman-devel@... https://lists.sourceforge.net/lists/listinfo/openwsman-devel |
| Free embeddable forum powered by Nabble | Forum Help |