Re: sysctl warns6 cleanup

看板DFBSD_submit作者時間21年前 (2005/01/09 03:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串5/10 (看更多)
On Sat, Jan 08, 2005 at 11:24:06AM -0800, Chris Pressey wrote: > On Sat, 8 Jan 2005 20:02:30 +0100 > Joerg Sonnenberger <joerg@britannica.bec.de> wrote: > > > On Sat, Jan 08, 2005 at 05:17:17PM +0100, Peter Schuller wrote: > > > @@ -518,20 +519,20 @@ > > > case 'A': > > > if (!nflag) > > > printf("%s%s", name, sep); > > > - printf("%.*s", len, p); > > > + printf("%.*s", (int)len, p); > > > return (0); > > > > > > > There should be at least a check for the value of len, to ensure that > > it actually fits into an int. > > Heh... come to think of it, isn't this kind of a silly use of printf()? > Couldn't we just use fwrite(p, len, 1, stdout) here instead? Yes, that's better. Joerg > > -Chris
文章代碼(AID): #11u3L300 (DFBSD_submit)
討論串 (同標題文章)
文章代碼(AID): #11u3L300 (DFBSD_submit)