Skip to contentSkip to conversation

fix checking strtab length in xc_core.c

PATCH In review Akio Takebe 2 participants 3 messages Sep 10, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix checking strtab length in xc_core.c

Hi,

I don't understard the meaning of the following check in xc_core.c. Is this correct patch?

tools/libxc/xc_core.c +1 -1
diff -r 9071521d4864 tools/libxc/xc_core.c
@@ -107,7 +107,7 @@ xc_core_strtab_get(struct xc_core_strtab
     if ( strtab->current + len > strtab->max )
     {
         char *tmp;
-        if ( strtab->max * 2 < strtab->max )
+        if ( strtab->current + len > strtab->max * 2 )
         {
             PERROR("too long string table");
             errno = ENOMEM;

Best Regards,

Akio Takebe

tools/libxc/xc_core.c +1 -1
diff -r 9071521d4864 tools/libxc/xc_core.c
@@ -107,7 +107,7 @@ xc_core_strtab_get(struct xc_core_strtab
     if ( strtab->current + len > strtab->max )
     {
         char *tmp;
-        if ( strtab->max * 2 < strtab->max )
+        if ( strtab->current + len > strtab->max * 2 )
         {
             PERROR("too long string table");
             errno = ENOMEM;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 4 lines · Akio Takebe

I don't understard the meaning of the following check in xc_core.c. Is this correct patch?

It's to avoid overflowing a fixed-size integer.

-- Keir

#2 lore raw

Hi, Keir

Quoted 3 lines

It's to avoid overflowing a fixed-size integer.

-- Keir

Thanks.

Best Regards,

Akio Takebe