[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/3.5/kdelibs/kinit
From:       Luboš Luňák <l.lunak () kde ! org>
Date:       2006-10-04 13:28:54
Message-ID: 1159968534.536056.13841.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 592336 by lunakl:

++paranoid



 M  +9 -0      start_kdeinit.c  


--- branches/KDE/3.5/kdelibs/kinit/start_kdeinit.c #592335:592336
@@ -42,6 +42,13 @@
 {
    char buf[ 1024 ];
    sprintf( buf, "/proc/%d/oom_adj", pid );
+   if( !enable ) {
+       /* Be paranoid and check that the pid we got from the pipe
+          belongs to this user. */
+       struct stat st;
+       if( lstat( buf, &st ) < 0 || st.st_uid != getuid())
+           return;
+   }
    int procfile = open( buf, O_WRONLY );
    if( procfile >= 0 ) {
       if( enable )
@@ -63,6 +70,8 @@
       perror( "pipe()" );
       return 1;
    }
+   if( argc > 1000 )
+       abort(); /* paranoid */
    set_protection( getpid(), 1 );
    switch( fork()) {
       case -1:
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic