From 396eb4f5cf8b37cd2a9f14d85764e03761ade19f Mon Sep 17 00:00:00 2001 From: Norbert Thiebaud Date: Mon, 18 Feb 2013 00:47:58 -0600 Subject: coverity#440141 Null Dereference MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ifdbfecdb5443024f7186882cf09d8fba998e94f2 Reviewed-on: https://gerrit.libreoffice.org/2213 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- autodoc/source/display/idl/hfi_typetext.cxx | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'autodoc') diff --git a/autodoc/source/display/idl/hfi_typetext.cxx b/autodoc/source/display/idl/hfi_typetext.cxx index a100066f3195..03c4b263a436 100644 --- a/autodoc/source/display/idl/hfi_typetext.cxx +++ b/autodoc/source/display/idl/hfi_typetext.cxx @@ -543,23 +543,19 @@ int HF_IdlTypeText::count_Sequences( const char * i_sFullType ) const { int ret = 0; + const char* pCount = i_sFullType; - for ( const char * pCount = i_sFullType; - *pCount != 0; - ) + while((pCount = strstr(pCount,"sequence")) != 0) { - pCount = strstr(pCount,"sequence"); - if (pCount != 0) + + pCount += sizeof("sequence"); // = strlen(sequence) + 1 for '<'. + if ( *(pCount-1) == '\0' ) { - pCount += sizeof("sequence"); // = strlen(sequence) + 1 for '<'. - if ( *(pCount-1) == '\0' ) - { - // SYNTAX_ERR - return 0; - } - ++ret; + // SYNTAX_ERR + return 0; } - } // end for + ret += 1; + } return ret; } -- cgit