ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/socket/image.C
(Generate patch)

Comparing deliantra/server/socket/image.C (file contents):
Revision 1.20 by root, Fri Feb 16 22:26:02 2007 UTC vs.
Revision 1.23 by root, Sat Mar 10 19:48:17 2007 UTC

282 LOG (llevError, "read_client_images: Image num %d not in 0..%d\n%s", num, nrofpixmaps, buf); 282 LOG (llevError, "read_client_images: Image num %d not in 0..%d\n%s", num, nrofpixmaps, buf);
283 abort (); 283 abort ();
284 } 284 }
285 285
286 /* Skip accross the number data */ 286 /* Skip accross the number data */
287 for (cp = buf + 6; *cp != ' '; cp++); 287 for (cp = buf + 6; *cp != ' '; cp++)
288 ;
289
288 len = atoi (cp); 290 len = atoi (cp);
289 if (len == 0 || len > MAX_IMAGE_SIZE) 291 if (len == 0 || len > MAX_IMAGE_SIZE)
290 { 292 {
291 LOG (llevError, "read_client_images: length not valid: %d > %d \n%s", len, MAX_IMAGE_SIZE, buf); 293 LOG (llevError, "read_client_images: length not valid: %d > %d \n%s", len, MAX_IMAGE_SIZE, buf);
292 abort (); 294 abort ();
439 */ 441 */
440void 442void
441send_image_sums (client *ns, char *params) 443send_image_sums (client *ns, char *params)
442{ 444{
443 int start, stop; 445 int start, stop;
444 char *cp, buf[MAX_BUF]; 446 char *cp;
445 447
446 packet sl; 448 packet sl;
447 449
448 start = atoi (params); 450 start = atoi (params);
449 for (cp = params; *cp != '\0'; cp++) 451 for (cp = params; *cp != '\0'; cp++)
464 for (int i = start; i <= stop; i++) 466 for (int i = start; i <= stop; i++)
465 { 467 {
466 ns->faces_sent[i] |= NS_FACESENT_FACE; 468 ns->faces_sent[i] |= NS_FACESENT_FACE;
467 469
468 int qq = get_face_fallback (ns->faceset, i); 470 int qq = get_face_fallback (ns->faceset, i);
471
472 if (sl.room () < 2 + 4 + 1 + new_faces[i].name.length () + 1)
473 break;
469 474
470 sl << uint16 (i) 475 sl << uint16 (i)
471 << uint32 (facesets[qq].faces[i].checksum) 476 << uint32 (facesets[qq].faces[i].checksum)
472 << uint8 (qq) 477 << uint8 (qq)
473 << data8 (&new_faces[i].name, new_faces[i].name.length () + 1); 478 << data8 (&new_faces[i].name, new_faces[i].name.length () + 1);
476 /* It would make more sense to catch this pre-emptively in the code above. 481 /* It would make more sense to catch this pre-emptively in the code above.
477 * however, if this really happens, we probably just want to cut down the 482 * however, if this really happens, we probably just want to cut down the
478 * size to less than 1000, since that is what we claim the protocol would 483 * size to less than 1000, since that is what we claim the protocol would
479 * support. 484 * support.
480 */ 485 */
486 //TODO: taken care of above, should simply abort or make sure the above code is correct
481 if (sl.length () >= MAXSOCKBUF) 487 if (sl.length () >= MAXSOCKBUF)
482 { 488 {
483 LOG (llevError, "send_image_send: buffer overrun, %d > %d\n", sl.length (), MAXSOCKBUF); 489 LOG (llevError, "send_image_send: buffer overrun, %d > %d\n", sl.length (), MAXSOCKBUF);
484 abort (); 490 abort ();
485 } 491 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines