Browse Source

* fixed potential buffer overflow errors (reported by Stian Skjelstad,
mantis #17922)

git-svn-id: trunk@16343 -

Jonas Maebe 14 years ago
parent
commit
fdfb21387f
1 changed files with 2 additions and 2 deletions
  1. 2 2
      rtl/inc/exeinfo.pp

+ 2 - 2
rtl/inc/exeinfo.pp

@@ -783,7 +783,7 @@ begin
      fillchar(secnamebuf,sizeof(secnamebuf),0);
      fillchar(secnamebuf,sizeof(secnamebuf),0);
      oldofs:=filepos(e.f);
      oldofs:=filepos(e.f);
      seek(e.f,e.secstrofs+elfsec.sh_name);
      seek(e.f,e.secstrofs+elfsec.sh_name);
-     blockread(e.f,secnamebuf,sizeof(secnamebuf),bufsize);
+     blockread(e.f,secnamebuf,sizeof(secnamebuf)-1,bufsize);
      seek(e.f,oldofs);
      seek(e.f,oldofs);
      secname:=strpas(secnamebuf);
      secname:=strpas(secnamebuf);
      if asecname=secname then
      if asecname=secname then
@@ -1141,7 +1141,7 @@ begin
   if length(dbgfn)=0 then
   if length(dbgfn)=0 then
     exit;
     exit;
   i:=align(length(dbgfn)+1,4);
   i:=align(length(dbgfn)+1,4);
-  if i>dbglinklen then
+  if (i+4)>dbglinklen then
     exit;
     exit;
   move(dbglink[i],dbgcrc,4);
   move(dbglink[i],dbgcrc,4);
   { current dir }
   { current dir }