On Mon, Dec 22, 2008 at 8:54 AM, Peter Stuge <[email protected]> wrote: > 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. >
arg! good point. I have gotten out of the habit of using any of these, as Plan 9 has this: smprint(format, ...) smprint mallocs the buffer as needed. snprintf now feels SOOO 20th-century, as my daughter might say :-) ron -- coreboot mailing list: [email protected] http://www.coreboot.org/mailman/listinfo/coreboot

