]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
prevent string overflow in radiant md2 loader
authorGarux <garux@mail.ru>
Fri, 22 Feb 2019 20:31:56 +0000 (23:31 +0300)
committerThomas Debesse <dev@illwieckz.net>
Tue, 27 Apr 2021 01:45:03 +0000 (03:45 +0200)
plugins/md3model/md2.cpp

index bb481bed3817fc8726d95df14d957be7fc1f3eeb..a347c5f4909f2b7e20909cd56cd2a6bab781dc46 100644 (file)
@@ -256,7 +256,8 @@ void MD2Surface_read( Model& model, const byte* buffer, ArchiveFile& file ){
        }
        else
        {
-               strcpy( skinname, skinnameRelative );
+               strncpy( skinname, skinnameRelative, MD2_MAX_SKINNAME - 1 );
+               skinname[MD2_MAX_SKINNAME - 1] = '\0';
        }
        surface.setShader( skinname );
        surface.updateAABB();