Changeset: 0847e4b51484 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0847e4b51484
Modified Files:
        buildtools/Mx/Def.c
Branch: default
Log Message:

Mx: avoid buffer overflow

The strncat() function appends not more than n characters from s2, and
then adds a terminating ?\0?.
Don't limit this to the size of s2, but to the remaining bytes left in
the buffer instead.


diffs (12 lines):

diff -r bd22cd63cbb0 -r 0847e4b51484 buildtools/Mx/Def.c
--- a/buildtools/Mx/Def.c       Mon Jan 10 08:53:44 2011 +0100
+++ b/buildtools/Mx/Def.c       Mon Jan 10 10:53:16 2011 +0100
@@ -505,7 +505,7 @@
                }
                if (f + size + 1 > blk + M_BLK)
                        Fatal("Mx:Too long block, use extra 
directives:[%s:%d].\n", mx_file, mx_line);
-               strncat(f, line, size + 1);
+               strncat(f, line, M_BLK - (f - blk));
                f += size;
                line = NextLine();
        }
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to