NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/38723
The following reply was made to PR bin/38723; it has been noted by GNATS.
From: FUKAUMI Naoki <fun%naobsd.org@localhost>
To: christos%zoulas.com@localhost (Christos Zoulas)
Cc: gnats-bugs%gnats.NetBSD.org@localhost
Subject: Re: bin/38723
Date: Wed, 17 Dec 2008 03:02:42 +0900
At Tue, 16 Dec 2008 12:12:45 -0500,
Christos Zoulas wrote:
> | Index: usr.sbin/cpuctl/arch/i386.c
> | ===================================================================
> | RCS file: /home/fun/cvsroot/NetBSD/src/usr.sbin/cpuctl/arch/i386.c,v
> | retrieving revision 1.13
> | diff -u -p -r1.13 i386.c
> | --- usr.sbin/cpuctl/arch/i386.c 14 Oct 2008 15:49:04 -0000 1.13
> | +++ usr.sbin/cpuctl/arch/i386.c 16 Dec 2008 16:20:51 -0000
> | @@ -1778,7 +1778,7 @@ static void
> | powernow_probe(struct cpu_info *ci)
> | {
> | uint32_t regs[4];
> | - char line[256];
> | + char *buf;
> |
> | x86_cpuid(0x80000000, regs);
> |
> | @@ -1787,7 +1787,10 @@ powernow_probe(struct cpu_info *ci)
> | return;
> | x86_cpuid(0x80000007, regs);
> |
> | - bitmask_snprintf(regs[3], CPUID_APM_FLAGS, line, sizeof(line));
> | + buf = malloc(MAXPATHLEN);
> | + bitmask_snprintf(regs[3], CPUID_APM_FLAGS, buf, MAXPATHLEN);
> | aprint_normal_dev(ci->ci_dev, "AMD Power Management features: %s\n",
> | - line);
> | + buf);
> | +
> | + free(buf);
> | }
>
> But I don't see the problem in the code. Why doesn't line get filled with
> the info in the bitmask_snprintf? 256 characters is clearly enough.
hmm.
then, replace BUFSIZ with reasonable value in cpuctl/bitmask.c.
I think "if (buflen < BUFSIZ)" is wrong.
--
FUKAUMI Naoki
Home |
Main Index |
Thread Index |
Old Index