Module Name: src Committed By: mlelstv Date: Mon Feb 4 01:07:34 UTC 2019
Modified Files: src/usr.sbin/sup/source: scmio.c Log Message: Fix handling of pushback operation which isn't using negative lengths for about 10 years. Found by gcc7. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/sup/source/scmio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.sbin/sup/source/scmio.c diff -u src/usr.sbin/sup/source/scmio.c:1.22 src/usr.sbin/sup/source/scmio.c:1.23 --- src/usr.sbin/sup/source/scmio.c:1.22 Fri Mar 8 20:56:44 2013 +++ src/usr.sbin/sup/source/scmio.c Mon Feb 4 01:07:34 2019 @@ -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 @@ readdata(size_t count, void *vdata, bool 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) {