questions about the function "get_namepart" in options.c

IaMaPlAyEr iamaplayer at gmail.com
Mon Mar 2 06:34:32 UTC 2009


Hi all,


I feel strange, that in the function get_namepart() in options.c
line 156:

  if ((slash != NULL) && (colon != NULL) &&
      (slash < colon)) {
    hostlen = slash - slashslash;
  }
  else if ((slash != NULL) && (colon == NULL)) {
    hostlen = slash - slashslash;
  }
  else if (colon != NULL) {
    hostlen = colon - slashslash;
    if (1 != sscanf(colon+1, "%d", port)) {
      log_err(0, "Not able to parse URL port: %s!", src);
      return -1;
    }
  }
  else {
    hostlen = strlen(src);
  }

if satisfy the first condition, the port are not set just like
sscanf(colon+1, "%d", port) at line 166.
why not add

if (1 != sscanf(colon+1, "%d", port)) {
      log_err(0, "Not able to parse URL port: %s!", src);
      return -1;
    }

at first if condition?

thank you for reading.

-- 
--
Sincerly,

HaveF
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.coova.org/pipermail/chilli/attachments/20090302/fe42180c/attachment.htm>


More information about the Chilli mailing list