You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ji...@apache.org on 2020/12/03 17:08:08 UTC

[openoffice] branch AOO42X updated: Just copy over the smallest number of bytes.

This is an automated email from the ASF dual-hosted git repository.

jim pushed a commit to branch AOO42X
in repository https://gitbox.apache.org/repos/asf/openoffice.git


The following commit(s) were added to refs/heads/AOO42X by this push:
     new 8ebeb3b  Just copy over the smallest number of bytes.
8ebeb3b is described below

commit 8ebeb3bfa02ed01d2f078b9da9cf4df3e7befbd8
Author: Jim Jagielski <ji...@gmail.com>
AuthorDate: Thu Dec 3 12:07:23 2020 -0500

    Just copy over the smallest number of bytes.
---
 main/soltools/mkdepend/parse.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/main/soltools/mkdepend/parse.c b/main/soltools/mkdepend/parse.c
index 5f60f73..a5f8537 100644
--- a/main/soltools/mkdepend/parse.c
+++ b/main/soltools/mkdepend/parse.c
@@ -347,9 +347,10 @@ int deftype (line, filep, file_red, file, parse_it, symbols)
 		 * copy the definition back to the beginning of the line.
 		 */
 		{
-			int len = strlen(line);
-			memmove (line, p, len);
-			line[len] = '\0';
+			int lenl = strlen(line);
+			int lenp = strlen(p);
+			memmove ( line, p, (lenl < lenp) ? lenl : lenp );
+			line[ (lenl < lenp) ? lenl : lenp ] = '\0';	/* belts and braces */
 		}
 		break;
 	case ELSE: