Commits

Jeremy Rossi  committed 559cec8

Patch from <r.ossec-dev@rutger.nl> fixing seg failt.

Hello,

I encountered a segmentation fault in syscheck_control. After investigating I found the problem was the use of uninitialized pointers in src/shared/read-agents.c in the case of "restored" files (line 65). The pointers are used in the code starting on line 145.

I also discussed it last week on IRC with ddpbsd.

I propose the attached patch. Please review as I'm not familiar with the ossec code.

Best regards,

Rutger Sassen

  • Participants
  • Parent commits 092730c

Comments (0)

Files changed (1)

File src/shared/read-agents.c

     sk_strchr(gid, ':', md5);
     sk_strchr(md5, ':', sha1);
     
+    p_size = size;
+    p_perm = perm;
+    p_uid = uid;
+    p_gid = gid;
+    p_md5 = md5;
+    p_sha1 = sha1;
+
     if(strcmp(attrs, "-1") == 0)
     {
         printf("File deleted. ");
     }
     else
     {
-        p_size = size;
-        p_perm = perm;
-        p_uid = uid;
-        p_gid = gid;
-        p_md5 = md5;
-        p_sha1 = sha1;
         printf("File added to the database. ");
     }