]> mj.ucw.cz Git - pciutils.git/commitdiff
Bug fixes to format_agp_rate().
authorMartin Mares <mj@ucw.cz>
Fri, 28 May 2004 11:46:02 +0000 (11:46 +0000)
committerMartin Mares <mj@ucw.cz>
Fri, 5 May 2006 12:18:18 +0000 (14:18 +0200)
git-archimport-id: mj@ucw.cz--public/pciutils--main--2.2--patch-41

ChangeLog
lspci.c

index 8e9e4879c80e13888801bc30997260ef5333b690..ba719ea4b7f5918852dc3c18687ee174c61dc7ac 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2004-05-28  Martin Mares  <mj@ucw.cz>
 
+       * lspci.c (format_agp_rate): Write "x16", not "x@".
+       (show_agp): rate[] could overflow.
+       Bugs reported by Jakub Bogusz <qboosh@pld-linux.org>.
+
        * lspci.c (show_ht_*): Show HyperTransport capability with all its
        details. Once again code by Maciej simplified (i.e., possibly broken)
        by me.
diff --git a/lspci.c b/lspci.c
index 6e0a77fd4857540342caf0e2cce938af1f5ff431..af94eeb0aa2bb2b5c042142597204f9ef3a99811 100644 (file)
--- a/lspci.c
+++ b/lspci.c
@@ -404,8 +404,7 @@ format_agp_rate(int rate, char *buf, int agp3)
       {
        if (c != buf)
          *c++ = ',';
-       *c++ = 'x';
-       *c++ = '0' + (1 << (i + 2*agp3));
+       c += sprintf(c, "x%d", 1 << (i + 2*agp3));
       }
   if (c != buf)
     *c = 0;
@@ -417,7 +416,7 @@ static void
 show_agp(struct device *d, int where, int cap)
 {
   u32 t;
-  char rate[8];
+  char rate[16];
   int ver, rev;
   int agp3 = 0;