]> arthur.barton.de Git - netatalk.git/commitdiff
Do some more sanity checking to ensure data integrity. Thanks to
authorjmarcus <jmarcus>
Thu, 24 Jan 2002 16:27:31 +0000 (16:27 +0000)
committerjmarcus <jmarcus>
Thu, 24 Jan 2002 16:27:31 +0000 (16:27 +0000)
didier <dgautheron@magic.fr>.

libatalk/dsi/dsi_tcp.c

index 599c337aaf692942637dc9507766450a22bdc7e5..008edf895eeb72220627abcf234b24d9ad9a51f4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: dsi_tcp.c,v 1.8 2002-01-17 06:13:44 srittau Exp $
+ * $Id: dsi_tcp.c,v 1.9 2002-01-24 16:27:31 jmarcus Exp $
  *
  * Copyright (c) 1997, 1998 Adrian Sun (asun@zoology.washington.edu)
  * All rights reserved. See COPYRIGHT.
@@ -147,8 +147,8 @@ static int dsi_tcp_open(DSI *dsi)
      * delinquent connections from causing mischief. */
     
     /* read in the first two bytes */
-    dsi_stream_read(dsi, block, 2);
-    if ((block[0] > DSIFL_MAX) || (block[1] > DSIFUNC_MAX)) {
+    len = dsi_stream_read(dsi, block, 2);
+    if (len <= 0 || (block[0] > DSIFL_MAX) || (block[1] > DSIFUNC_MAX)) {
       LOG(log_error, logtype_default, "dsi_tcp_open: invalid header");
       exit(1);
     }