------------------------------------------------------------ revno: 13927 revision-id: squid3@treenet.co.nz-20150927000940-4jb7e9fzet0lsve3 parent: squid3@treenet.co.nz-20150927000812-kv7gkjw799wdfilt fixes bug: http://bugs.squid-cache.org/show_bug.cgi?id=4208 author: Guy Helmer committer: Amos Jeffries branch nick: 3.5 timestamp: Sat 2015-09-26 17:09:40 -0700 message: Bug 4208: more than one port in wccp2_service_info line causes error ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20150927000940-4jb7e9fzet0lsve3 # target_branch: http://bzr.squid-cache.org/bzr/squid3/3.5 # testament_sha1: de7207ac3c9f2e34290ab2df781ba2180151176b # timestamp: 2015-09-27 00:15:19 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/3.5 # base_revision_id: squid3@treenet.co.nz-20150927000812-\ # kv7gkjw799wdfilt # # Begin patch === modified file 'src/wccp2.cc' --- src/wccp2.cc 2015-01-13 09:13:49 +0000 +++ src/wccp2.cc 2015-09-27 00:09:40 +0000 @@ -2238,12 +2238,19 @@ int i = 0; char *tmp = options; + static char copy[10]; while (size_t len = strcspn(tmp, ",")) { if (i >= WCCP2_NUMPORTS) { fatalf("parse_wccp2_service_ports: too many ports (maximum: 8) in list '%s'\n", options); } - int p = xatoi(tmp); + if (len > 6) { // 6 because "65535," + fatalf("parse_wccp2_service_ports: port value '%s' isn't valid (1..65535)\n", tmp); + } + + memcpy(copy, tmp, len); + copy[len] = '\0'; + int p = xatoi(copy); if (p < 1 || p > 65535) { fatalf("parse_wccp2_service_ports: port value '%s' isn't valid (1..65535)\n", tmp);