David L Stevens <dlstevens@us.ibm.com>
Tyler Coumbes <coumbes@gmail.com>
Josh Durgin <josh.durgin@dreamhost.com>
+ Wen Ruo Lv <lvroyce@linux.vnet.ibm.com>
[....send patches to get your name here....]
virConnectOpenFindURIAliasMatch(virConfValuePtr value, const char *alias, char **uri)
{
virConfValuePtr entry;
+ size_t alias_len;
+
if (value->type != VIR_CONF_LIST) {
virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Expected a list for 'uri_aliases' config parameter"));
}
entry = value->list;
+ alias_len = strlen(alias);
while (entry) {
char *offset;
size_t safe;
return -1;
}
- if (STREQLEN(entry->str, alias, offset-entry->str)) {
+ if (alias_len == (offset - entry->str) &&
+ STREQLEN(entry->str, alias, alias_len)) {
VIR_DEBUG("Resolved alias '%s' to '%s'",
alias, offset+1);
if (!(*uri = strdup(offset+1))) {