Re: [PATCH 4/6] libmount: fix memory overflow [AddressSanitizer]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 10, 2014 at 09:49:53PM +0000, Sami Kerola wrote:
> -		if (sscanf(line, " %128[^\n ]\n", name) != 1)
> +		if (sscanf(line, " %" stringify(sizeof(line) - 1)  "[^\n ]\n", name) != 1)
>  			continue;

 Are you really sure with this code? Did you test it?

 Your homework:

        #include <stdio.h>

        #define stringify(s) #s

        int main(int argc, char **argv)
        {
            char buf[123];
            printf("Size is:" stringify(sizeof(buf) - 1) ".\n");
            return 1;
        }

 result:

         $ make a 
         cc     a.c   -o a
         x2:~$ ./a
         Size is:sizeof(buf) - 1.


 Anyway, fixed and merged..

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux