Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sup/source Fix handling of pushback operation which...



details:   https://anonhg.NetBSD.org/src/rev/9a4a0530de47
branches:  trunk
changeset: 838890:9a4a0530de47
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Mon Feb 04 01:07:34 2019 +0000

description:
Fix handling of pushback operation which isn't using negative lengths
for about 10 years.

Found by gcc7.

diffstat:

 usr.sbin/sup/source/scmio.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (23 lines):

diff -r ec98af526196 -r 9a4a0530de47 usr.sbin/sup/source/scmio.c
--- a/usr.sbin/sup/source/scmio.c       Mon Feb 04 00:55:26 2019 +0000
+++ b/usr.sbin/sup/source/scmio.c       Mon Feb 04 01:07:34 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: scmio.c,v 1.22 2013/03/08 20:56:44 christos Exp $      */
+/*     $NetBSD: scmio.c,v 1.23 2019/02/04 01:07:34 mlelstv Exp $       */
 
 /*
  * Copyright (c) 1992 Carnegie Mellon University
@@ -434,11 +434,11 @@
        char *data = vdata;
 
        if (push) {
-               if (bufptr + count < buffer)
+               if (bufptr - count < buffer)
                        return (scmerr(-1, "No space in buffer %zu", count));
                bufptr -= count;
                bufcnt += count;
-               memcpy(bufptr, data, -count);
+               memcpy(bufptr, data, count);
                return (SCMOK);
        }
        if (count == 0 && data == NULL) {



Home | Main Index | Thread Index | Old Index