|
Bugzilla – Full Text Bug Listing |
| Summary: | double free or corruption with long host name | ||
|---|---|---|---|
| Product: | Sudo | Reporter: | joshua.gallagher |
| Component: | Sudo | Assignee: | Todd C. Miller <Todd.Miller> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | joshua.gallagher |
| Priority: | normal | ||
| Version: | 1.6.9 | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Attachments: |
Force hostname buffer to be NUL terminated.
Force hostname buffer to be NUL terminated. |
||
|
Description
joshua.gallagher
2008-10-28 14:10:16 MDT
Sudo expects gethostname() to NUL terminate the buffer, but it sounds like on Linux with a 64 char hostname this is not happening. Please try the attached patch and see if it solves the problem for you. Created attachment 234 [details]
Force hostname buffer to be NUL terminated.
This bug was raised against Sudo version 1.6.9p10 I download the latest code and repeated by test. When running sudo-1.6.9p17 I get the following: sudo: can't get hostname: Success So, it seems like between p10 and p17 this has been bullet proofed a little bit. I applied your patch and I'm getting the same error I mentioned in my last post: ./sudo insmod /home/jgallagher/6056/client/linux/fs/maxifs/maxifs.ko sudo: can't get hostname: Success Not knowing the code, it almost suggests that the p10 to p17 changes error check against the situation where the gethostname() returns something it doesn't like and never gets to be evaluated by your new code. That probably indicates that the length passed in to gethostname() should include the extra byte for the NUL. I hadn't noticed you were running 1.6.9p10. I've updated the diff attached to the bug. The content of attachment 234 [details] has been deleted by Todd C Miller <Todd.Miller@courtesan.com> without providing any reason. The token used to delete this attachment was generated at 2008-10-28 17:03:32 EST5EDT. Created attachment 235 [details]
Force hostname buffer to be NUL terminated.
Perfect! Insmod my kernel module using the patched version of the code, located in my local sudo-1.6.9p17 directory: jgallagher@magus:~/sudo-1.6.9p17$ ./sudo insmod ../6056/client/linux/fs/maxifs/maxifs.ko Prove that my hostname is still set to the long name (irrespective of my bash prompt). jgallagher@magus:~/sudo-1.6.9p17$ hostname 1234567890123456789012345678901234567890123456789012345678901234 Prove that the module was inserted: jgallagher@magus:~/sudo-1.6.9p17$ lsmod |grep maxifs maxifs 39760 0 Remove the module and perform the insert using the sudo in my path, i.e. the unpatched sudo-1.6.9p10, to prove that it still fails: jgallagher@magus:~/sudo-1.6.9p17$ ./sudo rmmod maxifs.ko jgallagher@magus:~/sudo-1.6.9p17$ sudo insmod ../6056/client/linux/fs/maxifs/maxifs.ko *** glibc detected *** sudo: double free or corruption (out): 0x080591d8 *** ======= Backtrace: ========= /lib/tls/i686/cmov/libc.so.6[0xb7edda85] <snip> ----------------------- I'd say it's fixed. Thanks! |