Jump to content











Photo
- - - - -

[patch]tftpd_thread.c check ACK pkt size by mistake


  • Please log in to reply
2 replies to this topic

#1 Colin

Colin

    Newbie

  • Members
  • 10 posts
  •  
    China

Posted 27 October 2010 - 09:32 AM

In tftpd32 3.50 source code, we can find tftpd64 (amd64) resouce (tftpd64_gui missing)
When build my local version, I found tftpd64 can't send file by tftp,
error like this:
rcvd packet too short

I capture the TFTP ACK packet and find no problem.
I check the code in tftpd_thread.c and tftp.h.
I found TFTP_ACK_HEADERSIZE is integer size and does not need to do sizeof again.
Original code does the operation something like sizeof(sizeof(void)). Result is 4 in 32bit system and 8 in 64bit. But TFTP block 0 ACK is 4 byte, then tftpd64 stop working and throw error message.

patch, _services\tftpd_thread.c
[codebox]
tp = (struct tftphdr *) pTftp->b.ackbuf;

//////////////////////////////////////////////
// read the message
//////////////////////////////////////////////
-- if (Rc<sizeof TFTP_ACK_HEADERSIZE)
++ if (Rc<TFTP_ACK_HEADERSIZE)
{
LOG (1, "rcvd packet too short");
}
[/codebox]

#2 Colin

Colin

    Newbie

  • Members
  • 10 posts
  •  
    China

Posted 29 October 2010 - 02:37 PM

Another patch,
I think all
[codebox]LONG lParam[/codebox] should be FIX to [codebox]LPARAM lParam[/codebox] At lease I found [Show Dir] dialog and [Local File] dialog may crash in tftpd64 by this bug.

#3 Colin

Colin

    Newbie

  • Members
  • 10 posts
  •  
    China

Posted 29 October 2010 - 03:14 PM

and FIX
[codebox]long CALLBACK TftpClientFileNameProc (HWND hWnd, UINT message, WPARAM wParam, LONG lParam) int CALLBACK TftpClientProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) [/codebox] to [codebox]LRESULT CALLBACK TftpClientFileNameProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) LRESULT CALLBACK TftpClientProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
[/codebox]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users