]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Fixes for buffer loss and DOS attacks
authorDanny Mayer <mayer@ntp.org>
Tue, 13 Dec 2005 04:35:01 +0000 (23:35 -0500)
committerDanny Mayer <mayer@ntp.org>
Tue, 13 Dec 2005 04:35:01 +0000 (23:35 -0500)
bk: 439e4f7554JGPlt8_hEDKpmSKdbssQ

ports/winnt/include/ntp_iocompletionport.h
ports/winnt/ntpd/ntp_iocompletionport.c

index d02c0f20d65fa55982e6a169e32a9014e49b0cb0..fa91e0735f5c66585b6269ce23af8ae4546e1e58 100644 (file)
@@ -38,7 +38,7 @@ extern        DWORD   io_completion_port_sendto (struct interface *, struct pkt *, int, s
 
 extern HANDLE get_io_event (void);
 
-struct recvbuf *GetReceivedBuffers(void);
+int GetReceivedBuffers(void);
 
 static int QueueIORead( struct refclockio * );
 
index d92843aa541f197eee979af484223e2d7892cb00..bc556393570ba6d5dab9aeb9eb448d326163c00e 100644 (file)
@@ -278,12 +278,16 @@ static unsigned long QueueSocketRecv(SOCKET s) {
                                             HEAP_ZERO_MEMORY,
                                             sizeof(IoCompletionInfo));
        if (lpo == NULL)
+       {
+               msyslog(LOG_ERR, "Out of heap memory for recvbufs: %m");
                return 0;
+       }
 
        buff = get_free_recv_buffer();
 
        if (buff == NULL)
        {
+               msyslog(LOG_ERR, "Out of memory for recvbufs: %m");
                HeapFree(hHeapHandle, 0, lpo);
                return 0;
        }
@@ -357,7 +361,7 @@ OnSocketRecv(DWORD i, IoCompletionInfo *lpo, DWORD Bytes)
                buff->dstadr = inter;
 #ifdef DEBUG
                if (debug > 3)
-                       printf("Received %d bytes from %s\n", stoa(&buff->recv_srcadr));
+                       printf("Received %d bytes from %s\n", Bytes, stoa(&buff->recv_srcadr));
 #endif
                add_full_recv_buffer(buff);
                if( !SetEvent( WaitableIoEventHandle ) ) {