# --- ROCK-COPYRIGHT-NOTE-BEGIN --- # # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # Please add additional copyright information _after_ the line containing # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by # the ./scripts/Create-CopyPatch script. Do not edit this copyright text! # # ROCK Linux: rock-src/package/tsa/zebra/10zebra-0.93b-ospfd-md5-buffer.patch # ROCK Linux is Copyright (C) 1998 - 2003 Clifford Wolf # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. A copy of the GNU General Public # License can be found at Documentation/COPYING. # # Many people helped and are helping developing ROCK Linux. Please # have a look at http://www.rocklinux.org/ and the Documentation/TEAM # file for details. # # --- ROCK-COPYRIGHT-NOTE-END --- --- ./ospfd/ospf_packet.c.orig Mon Aug 12 08:49:16 2002 +++ ./ospfd/ospf_packet.c Fri Oct 11 12:28:36 2002 @@ -226,7 +226,13 @@ { struct ospf_packet *new; - new = ospf_packet_new (op->length); + if (stream_get_endp(op->s) != op->length) { + zlog_warn ("ospf_packet_dup stream %d ospf_packet %d size mismatch", + STREAM_SIZE(op->s), op->length); + } + + /* Reserve space for MD5 authentication that may be added later. */ + new = ospf_packet_new (stream_get_endp(op->s) + OSPF_AUTH_MD5_SIZE); ospf_stream_copy (new->s, op->s); new->dst = op->dst; @@ -341,7 +347,12 @@ stream_set_putp (op->s, oldputp); /* We do *NOT* increment the OSPF header length. */ - op->length += OSPF_AUTH_MD5_SIZE; + op->length = ntohs (ospfh->length) + OSPF_AUTH_MD5_SIZE; + + if (stream_get_endp(op->s) != op->length) { + zlog_warn("ospf_make_md5_digest: length mismatch stream %d ospf_packet %d", + stream_get_endp(op->s), op->length); + } return OSPF_AUTH_MD5_SIZE; }