Potentially unsave string processing code replaced

git-svn-id: https://svn.code.sf.net/p/qlscribe/svn/trunk@98 cac9541e-1b8d-4bfa-827e-589bba606050
This commit is contained in:
ruglory
2009-02-25 21:57:16 +00:00
parent c7489c8aa8
commit e9e2e0ca9e
+3 -4
View File
@@ -38,11 +38,10 @@ DBusHandlerResult IntrospectHandler::processMessage( const Message &msg )
if( pathlen != 1 ) ++pathlen;
const char *end = strchr( DBusManagerPath + pathlen, '/' );
if( end ) {
char sub[128];
const int sublen = end - DBusManagerPath - pathlen;
strncpy( sub, DBusManagerPath + pathlen, sublen );
sub[ sublen ] = 0;
introspect += std::string( "<node name=\"" ) + sub + "\"/>";
introspect += "<node name=\"" +
std::string( DBusManagerPath + pathlen, sublen )
+ "\"/>";
} else
introspect += "<node name=\"Manager\"/><node name=\"drives\"/>";
}