- Timestamp:
- 06/21/10 17:41:30 (20 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ithildin-1.1/modules/ircd/addons/hostcrypt.c
r823 r852 220 220 221 221 if (from->client != NULL) 222 sm.len = s printf(buf, ":%s!%s@%s %s %s%s", from->client->nick,222 sm.len = snprintf(buf, sizeof(buf), ":%s!%s@%s %s %s%s", from->client->nick, 223 223 from->client->user, from->client->orighost, cmd, 224 224 (to != NULL ? to : ""), (to != NULL ? " " : "")); 225 225 else if (from->server != NULL) 226 sm.len = s printf(buf, ":%s %s %s%s", from->server->name, cmd,226 sm.len = snprintf(buf, sizeof(buf), ":%s %s %s%s", from->server->name, cmd, 227 227 (to != NULL ? to : ""), (to != NULL ? " " : "")); 228 228 else 229 sm.len = s printf(buf, "%s %s%s", cmd,229 sm.len = snprintf(buf, sizeof(buf), "%s %s%s", cmd, 230 230 (to != NULL ? to : ""), (to != NULL ? " " : "")); 231 231 if (msg != NULL) … … 326 326 /* this is the easy case.. */ 327 327 if ((s = strchr(cli->orighost, '.')) != NULL) 328 s printf(buf, "%s%u%s%s", hostcrypt.prefix, hash, s,328 snprintf(buf, sizeof(buf), "%s%u%s%s", hostcrypt.prefix, hash, s, 329 329 hostcrypt.suffix); 330 330 else 331 s printf(buf, "%s%u.%s%s", hostcrypt.prefix, hash, cli->orighost,331 snprintf(buf, sizeof(buf), "%s%u.%s%s", hostcrypt.prefix, hash, cli->orighost, 332 332 hostcrypt.suffix); 333 333 … … 345 345 memset(s + 8, 0, 8); /* blech. ;) */ 346 346 inet_ntop(PF_INET6, &i6a, buf, HOSTLEN + 1); 347 s printf(buf +strlen(buf), "%u", hash);347 snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%u", hash); 348 348 349 349 return buf; … … 360 360 phash = (austhex_hash(quads[0]) + austhex_hash(quads[1]) + 361 361 austhex_hash(quads[2])) % AUSTHEX_HASH_SMALL; 362 s printf(buf, "%s.%s.%u.%u", quads[0], quads[1], phash, hash);362 snprintf(buf, sizeof(buf), "%s.%s.%u.%u", quads[0], quads[1], phash, hash); 363 363 364 364 return buf; … … 422 422 if (s == NULL) 423 423 /* singleton string like 'localhost' */ 424 s printf(buf, "%32s.%s", md5buf, cli->orighost);424 snprintf(buf, sizeof(buf), "%32s.%s", md5buf, cli->orighost); 425 425 else { 426 426 while (*s != '.' && s > cli->orighost) … … 428 428 if (s == cli->orighost) 429 429 /* host is in pure domain.tld form */ 430 s printf(buf, "%32s.%s", md5buf, cli->orighost);430 snprintf(buf, sizeof(buf), "%32s.%s", md5buf, cli->orighost); 431 431 else 432 432 /* s is the second to last . in the string now */ 433 s printf(buf, "%s", s + 1);433 snprintf(buf, sizeof(buf), "%s", s + 1); 434 434 } 435 435 /* buf now contains the host we wish to md5 on */
Note: See TracChangeset
for help on using the changeset viewer.
