[exim-dev] [Bug 890] New: src/dkim-exim.c doesn't check open…

Top Page
Delete this message
Reply to this message
Author: Simon Arlott
Date:  
To: exim-dev
Subject: [exim-dev] [Bug 890] New: src/dkim-exim.c doesn't check open() return value
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=890
           Summary: src/dkim-exim.c doesn't check open() return value
           Product: Exim
           Version: N/A
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Transports
        AssignedTo: nigel@???
        ReportedBy: bugzilla.exim.simon@???
                CC: exim-dev@???



privkey_fd = open(CS dkim_private_key,O_RDONLY);
    (void)read(privkey_fd,big_buffer,16383);
    (void)close(privkey_fd);


This should be checking the return values of open() and read().
If the file is larger than the buffer then an error should be returned.

[pid 38070] open("/home/simon/src/exim-git/test/dkim/private.key", O_RDONLY) =
-1 ENOENT (No such file or directory)
[pid 38070] read(4294967295, 0x7bb020, 16383) = -1 EBADF (Bad file descriptor)
[pid 38070] close(4294967295)           = -1 EBADF (Bad file descriptor)


Also, with no private key, it just closes the sending SMTP socket:
(exim) [pid 38070] write(2, "19:48:22 38070 ok=0 send_quit=0 send_rset=1
continue_more=0 yield=1 first_address is NULL"..., 90
       [pid 38070] close(6)                    = 0


(nc)   write(4, "354\n"..., 4)                 = 4
       select(16, [0 4], NULL, NULL, NULL)     = 1 (in [4])
       read(4, ""..., 8192)                    = 0



--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email