]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - prvm_cmds.c
Fix an overrun in altstr_prepare.
[xonotic/darkplaces.git] / prvm_cmds.c
index 187930b23835891bd0f4d881c252251d46b4966f..160327ff20c825600d9b2b5cffd4ad6c0ed4df69 100644 (file)
@@ -4435,7 +4435,7 @@ void VM_altstr_prepare(prvm_prog_t *prog)
        instr = PRVM_G_STRING( OFS_PARM0 );
 
        for( out = outstr, in = instr, size = sizeof(outstr) - 1 ; size && *in ; size--, in++, out++ )
-               if( *in == '\'' ) {
+               if( *in == '\'' && size > 1) {
                        *out++ = '\\';
                        *out = '\'';
                        size--;