[PATCH] Xen capabilities - nul-terminate the token and a couple of cleanups

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




--
Emerging Technologies, Red Hat  http://et.redhat.com/~rjones/
64 Baker Street, London, W1U 7DF     Mobile: +44 7866 314 421
 "[Negative numbers] darken the very whole doctrines of the equations
 and make dark of the things which are in their nature excessively
 obvious and simple" (Francis Maseres FRS, mathematician, 1759)
Index: src/xen_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/xen_internal.c,v
retrieving revision 1.66
diff -u -r1.66 xen_internal.c
--- src/xen_internal.c	20 Mar 2007 15:22:39 -0000	1.66
+++ src/xen_internal.c	22 Mar 2007 14:12:35 -0000
@@ -1573,10 +1573,12 @@
      * this buffer.  Parse out the features from each token.
      */
     for (str = line, nr_guest_archs = 0;
-         nr_guest_archs < (sizeof(guest_archs)/sizeof(struct guest_arch))
+         nr_guest_archs < sizeof guest_archs / sizeof guest_archs[0]
              && (token = strtok_r (str, " ", &saveptr)) != NULL;
          str = NULL) {
-        if (regexec (&xen_cap_rec, token, (sizeof(subs)/sizeof(regmatch_t)), subs, 0) == 0) {
+        if (regexec (&xen_cap_rec, token, sizeof subs / sizeof subs[0],
+                     subs, 0) == 0) {
+            token[subs[0].rm_eo] = '\0';
             guest_archs[nr_guest_archs].token = token;
             guest_archs[nr_guest_archs].hvm =
                 strncmp (&token[subs[1].rm_so], "hvm", 3) == 0;

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]