Skip to content

Commit 49d3e07

Browse files
Add test case for #10137 (#3558)
1 parent 7711882 commit 49d3e07

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

test/testbufferoverrun.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4737,6 +4737,19 @@ class TestBufferOverrun : public TestFixture {
47374737
" return foo(1, &single_value);\n"
47384738
"}\n");
47394739
ASSERT_EQUALS("", errout.str());
4740+
4741+
check("void f(const char* app, size_t applen) {\n" // #10137
4742+
" char* tmp_de = NULL;\n"
4743+
" char** str = &tmp_de;\n"
4744+
" char* tmp = (char*)realloc(*str, applen + 1);\n"
4745+
" if (tmp) {\n"
4746+
" *str = tmp;\n"
4747+
" memcpy(*str, app, applen);\n"
4748+
" (*str)[applen] = '\\0';\n"
4749+
" }\n"
4750+
" free(*str);\n"
4751+
"}\n", "test.c");
4752+
ASSERT_EQUALS("", errout.str());
47404753
}
47414754
};
47424755

0 commit comments

Comments
 (0)