Author: Armin Rigo <ar...@tunes.org> Branch: stmgc-c7 Changeset: r73989:8ee8f761ca9d Date: 2014-10-17 12:39 +0200 http://bitbucket.org/pypy/pypy/changeset/8ee8f761ca9d/
Log: Be careful here diff --git a/rpython/translator/stm/src_stm/extracode.h b/rpython/translator/stm/src_stm/extracode.h --- a/rpython/translator/stm/src_stm/extracode.h +++ b/rpython/translator/stm/src_stm/extracode.h @@ -117,9 +117,15 @@ line += ((unsigned char *)lnotab)[i + 1]; } - return snprintf(outputbuf, outputbufsize, - "File \"%s%.*s\", line %ld, in %.*s%s", - fntrunc, (int)fnlen, fn, line, (int)nlen, name, ntrunc); + int result; + result = snprintf(outputbuf, outputbufsize, + "File \"%s%.*s\", line %ld, in %.*s%s", + fntrunc, (int)fnlen, fn, line, (int)nlen, name, ntrunc); + if (result >= outputbufsize) + result = outputbufsize - 1; + if (result < 0) + result = 0; + return result; } void pypy_stm_setup_expand_marker(long co_filename_ofs, _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit