Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/devel/diffbreaker/files/diffbreaker Fix errors when co...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/bd792b39e5c4
branches:  trunk
changeset: 434486:bd792b39e5c4
user:      nat <nat%pkgsrc.org@localhost>
date:      Wed Jun 17 10:52:03 2020 +0000

description:
Fix errors when compiling with __SSP_FORTIFY_LEVEL > 1.

Found by wiz@.

diffstat:

 devel/diffbreaker/files/diffbreaker/diffbreaker.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (44 lines):

diff -r 7939fcff7e05 -r bd792b39e5c4 devel/diffbreaker/files/diffbreaker/diffbreaker.c
--- a/devel/diffbreaker/files/diffbreaker/diffbreaker.c Wed Jun 17 10:34:15 2020 +0000
+++ b/devel/diffbreaker/files/diffbreaker/diffbreaker.c Wed Jun 17 10:52:03 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: diffbreaker.c,v 1.1 2020/05/24 16:44:20 nat Exp $ */
+/* $NetBSD: diffbreaker.c,v 1.2 2020/06/17 10:52:03 nat Exp $ */
 
 /*-
  * Copyright (c) 2018, 2019 Nathanial Sloss <nathanialsloss%yahoo.com.au@localhost>
@@ -138,6 +138,7 @@
                        display = true;
                        writesect = true;
                        writetome = true;
+                       /* fallthrough */
                default:
                        if (j != i)
                                strcpy(ORIGBUF(j), ORIGBUF(i));
@@ -205,7 +206,8 @@
                if (action[i - l] == 2)
                        break;
        }
-       l--;
+       if (l > 0)
+               l--;
        if (tmpcontext)
                j = update_context(tmpcontext, j, i - l);
 
@@ -410,7 +412,6 @@
                }
        }
        l = n--;
-       cpl--;
 
        size_t totalalloc = (size_t)(l * cpl);
        if (totalalloc <= 0 || l <= 0)
@@ -435,6 +436,8 @@
        }
        memset(newaction, 0, (size_t)l * sizeof(*newaction));
        memset(action, 0, (size_t)l * sizeof(*action));
+       memset(buffer, 0, (size_t)totalalloc * sizeof(*buffer));
+       memset(newbuffer, 0, (size_t)totalalloc * sizeof(*newbuffer));
 
        l = 0;
        j = n = 0;



Home | Main Index | Thread Index | Old Index