Changeset 135 for branches/samba-3.0/source/lib
- Timestamp:
- May 29, 2008, 11:30:31 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.0/source/lib/util_sock.c
r30 r135 697 697 698 698 /**************************************************************************** 699 Read an smb from a fd. Note that the buffer *MUST* be of size 700 BUFFER_SIZE+SAFETY_MARGIN. 699 Read an smb from a fd. 701 700 The timeout is in milliseconds. 702 701 This function will return on receipt of a session keepalive packet. … … 704 703 ****************************************************************************/ 705 704 706 BOOL receive_smb_raw(int fd, char *buffer, unsigned int timeout)705 BOOL receive_smb_raw(int fd, char *buffer, size_t buflen, unsigned int timeout) 707 706 { 708 707 ssize_t len,ret; … … 725 724 } 726 725 727 /* 728 * A WRITEX with CAP_LARGE_WRITEX can be 64k worth of data plus 65 bytes 729 * of header. Don't print the error if this fits.... JRA. 730 */ 731 732 if (len > (BUFFER_SIZE + LARGE_WRITEX_HDR_SIZE)) { 726 if (len > buflen) { 733 727 DEBUG(0,("Invalid packet length! (%lu bytes).\n",(unsigned long)len)); 734 if (len > BUFFER_SIZE + (SAFETY_MARGIN/2)) { 735 736 /* 737 * Correct fix. smb_read_error may have already been 738 * set. Only set it here if not already set. Global 739 * variables still suck :-). JRA. 740 */ 741 742 if (smb_read_error == 0) 743 smb_read_error = READ_ERROR; 744 return False; 745 } 728 729 /* 730 * smb_read_error may have already been 731 * set. Only set it here if not already set. Global 732 * variables still suck :-). JRA. 733 */ 734 735 if (smb_read_error == 0) 736 smb_read_error = READ_ERROR; 737 return False; 746 738 } 747 739 … … 773 765 ****************************************************************************/ 774 766 775 BOOL receive_smb(int fd, char *buffer, unsigned int timeout)776 { 777 if (!receive_smb_raw(fd, buffer, timeout)) {767 BOOL receive_smb(int fd, char *buffer, size_t buflen, unsigned int timeout) 768 { 769 if (!receive_smb_raw(fd, buffer, buflen, timeout)) { 778 770 return False; 779 771 }
Note:
See TracChangeset
for help on using the changeset viewer.