trafficserver-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpeach <...@git.apache.org>
Subject [GitHub] trafficserver pull request #783: TS-3816 : Replace ptr_len_cmp with memcmp
Date Tue, 05 Jul 2016 20:53:33 GMT
Github user jpeach commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/783#discussion_r69635990
  
    --- Diff: proxy/StatPages.cc ---
    @@ -83,7 +83,7 @@ StatPagesManager::handle_http(Continuation *cont, HTTPHdr *header)
         host_len       = unescapifyStr(host);
     
         for (i = 0; i < n_stat_pages; i++) {
    -      if (ptr_len_cmp(host, host_len, stat_pages[i].module) == 0) {
    +      if ((host_len == sizeof(stat_pages[i].module)) && (memcmp(host, stat_pages[i].module,
host_len) == 0)) { 
    --- End diff --
    
    ``sizeof(stat_pages[i].module)`` is giving you the size of the pointer, not the length
of the string. You would have to do something like this:
    ```C
    host_len == strlen(stat_pages[i].module) && memcmp(host, stat_pages[i].module,
host_len) == 0
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message