소스 검색

Merge pull request #746 from jeffbencteux/check-icmp-setuid

check_icmp: Uncheck return values of set*id() family functions
aaronagios 1 년 전
부모
커밋
8254431edd
1개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 1
      plugins-root/check_icmp.c

+ 3 - 1
plugins-root/check_icmp.c

@@ -725,7 +725,9 @@ int main(int argc, char **argv) {
   }
 
   /* now drop privileges (no effect if not setsuid or geteuid() == 0) */
-  setuid(getuid());
+  if (setuid(getuid()) == -1) {
+    crash("dropping privileges failed");
+  }
 
 #ifdef SO_TIMESTAMP
   if (setsockopt(icmp_sock, SOL_SOCKET, SO_TIMESTAMP, &on, sizeof(on))) {