[coreboot] need help with #define macro

Peter Stuge peter at stuge.se
Mon Dec 22 17:54:08 CET 2008


ron minnich wrote:
> char *partport = "parport0";
> static char parportname[MAXPATHLEN];
> 
> sprintf(parportname, "/proc/sys/dev/parport/%s/base-addr", parport );

Please make sure to always use

snprintf(parportname, sizeof(parportname), "/proc/...", parport);

to avoid buffer overflows, and check the return value. Not that I
always do, but I should.


//Peter




More information about the coreboot mailing list