From: srittau Date: Tue, 12 Mar 2002 16:16:55 +0000 (+0000) Subject: Temp solution from trunk for bailing out on invalid DSI packets. X-Git-Tag: netatalk-1-5-3~11 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;ds=sidebyside;h=a0f185763fe6c9b57e335f98fa3c5d91d73cb643;p=netatalk.git Temp solution from trunk for bailing out on invalid DSI packets. --- diff --git a/libatalk/dsi/dsi_stream.c b/libatalk/dsi/dsi_stream.c index 8b79dae6..026d8204 100644 --- a/libatalk/dsi/dsi_stream.c +++ b/libatalk/dsi/dsi_stream.c @@ -1,5 +1,5 @@ /* - * $Id: dsi_stream.c,v 1.4.2.1 2002-02-08 00:03:29 srittau Exp $ + * $Id: dsi_stream.c,v 1.4.2.2 2002-03-12 16:16:55 srittau Exp $ * * Copyright (c) 1998 Adrian Sun (asun@zoology.washington.edu) * All rights reserved. See COPYRIGHT. @@ -182,6 +182,14 @@ int dsi_stream_receive(DSI *dsi, void *buf, const int ilength, dsi->header.dsi_flags = block[0]; dsi->header.dsi_command = block[1]; + /* FIXME, not the right place, + but we get a server disconnect without reason in the log + */ + if (!block[1]) { + LOG(log_error, logtype_default, "dsi_stream_receive: invalid packet, fatal"); + return 0; + } + memcpy(&dsi->header.dsi_requestID, block + 2, sizeof(dsi->header.dsi_requestID)); memcpy(&dsi->header.dsi_code, block + 4, sizeof(dsi->header.dsi_code));