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

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


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

commit da8916591d9de050d9e2d4761e81cd224d29e5fa
Author: Jim Jagielski <[email protected]>
AuthorDate: Thu Dec 3 12:07:23 2020 -0500

    Just copy over the smallest number of bytes.
    
    (cherry picked from commit 8ebeb3bfa02ed01d2f078b9da9cf4df3e7befbd8)
---
 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:

Reply via email to