From: plugwash Date: Mon, 15 Jun 2009 20:55:41 +0000 (+0000) Subject: add some extra sanity checking to blinklist and fix a line ending in dnswin X-Git-Url: http://www.lcore.org/git/lcore.git/commitdiff_plain/5ba06ea7bd30494fe55f81a3bc07c8d1eb3702e0?hp=47be802778ed1f8dc869a92d93d169908f51c85a add some extra sanity checking to blinklist and fix a line ending in dnswin git-svn-id: file:///svnroot/lcore/trunk@48 b1de8a11-f9be-4011-bde0-cc7ace90066a --- diff --git a/blinklist.pas b/blinklist.pas index 27232f4..7391bdf 100755 --- a/blinklist.pas +++ b/blinklist.pas @@ -55,10 +55,13 @@ var implementation +uses sysutils; + procedure linklistadd(var baseptr:tlinklist;newptr:tlinklist); var p:tlinklist; begin + if (newptr=baseptr) or assigned(newptr.prev) then raise exception.create('linklist double insertion detected'); p := baseptr; baseptr := newptr; baseptr.prev := nil; @@ -71,12 +74,15 @@ begin if item = baseptr then baseptr := item.next; if item.prev <> nil then item.prev.next := item.next; if item.next <> nil then item.next.prev := item.prev; + item.prev := nil; + item.next := nil; end; procedure linklist2add(var baseptr,newptr:tlinklist2); var p:tlinklist2; begin + if (newptr=baseptr) or assigned(newptr.prev) then raise exception.create('linklist2 double insertion detected'); p := baseptr; baseptr := newptr; baseptr.prev2 := nil; @@ -89,6 +95,8 @@ begin if item = baseptr then baseptr := item.next2; if item.prev2 <> nil then item.prev2.next2 := item.next2; if item.next2 <> nil then item.next2.prev2 := item.prev2; + item.prev2 := nil; + item.next2 := nil; end; constructor tlinklist.create; diff --git a/dnswin.pas b/dnswin.pas index 9f66cda..e9c2a16 100755 --- a/dnswin.pas +++ b/dnswin.pas @@ -233,7 +233,7 @@ var getnameinforesult : integer; begin - makeinaddrv(ip,'1',sa); + makeinaddrv(ip,'1',sa); populateprocvars; setlength(result,1025); getnameinforesult := getnameinfo(@sa,sizeof(tinetsockaddrv),pchar(result),length(result),nil,0,0);