Module Name: src Committed By: christos Date: Sat Dec 12 18:19:34 UTC 2020
Modified Files: src/external/bsd/pkg_install/dist/lib: plist.c Log Message: Don't try to memcpy (size_t)-1 bytes! To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/external/bsd/pkg_install/dist/lib/plist.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/bsd/pkg_install/dist/lib/plist.c diff -u src/external/bsd/pkg_install/dist/lib/plist.c:1.4 src/external/bsd/pkg_install/dist/lib/plist.c:1.5 --- src/external/bsd/pkg_install/dist/lib/plist.c:1.4 Wed Dec 2 08:53:50 2020 +++ src/external/bsd/pkg_install/dist/lib/plist.c Sat Dec 12 13:19:34 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: plist.c,v 1.4 2020/12/02 13:53:50 wiz Exp $ */ +/* $NetBSD: plist.c,v 1.5 2020/12/12 18:19:34 christos Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -7,7 +7,7 @@ #if HAVE_SYS_CDEFS_H #include <sys/cdefs.h> #endif -__RCSID("$NetBSD: plist.c,v 1.4 2020/12/02 13:53:50 wiz Exp $"); +__RCSID("$NetBSD: plist.c,v 1.5 2020/12/12 18:19:34 christos Exp $"); /* * FreeBSD install - a package for the installation and maintainance @@ -637,15 +637,16 @@ delete_package(Boolean ign_err, package_ fail = FAIL; goto pkgdb_cleanup; } - } - memcpy(&buf[SymlinkHeaderLen], tmp2, cc); - buf[SymlinkHeaderLen + cc] = 0x0; - if (strcmp(buf, p->next->name) != 0) { - printf("symlink %s is not same as recorded value, %s: %s\n", - buf, Force ? "deleting anyway" : "not deleting", tmp); - if (!Force) { - fail = FAIL; - goto pkgdb_cleanup; + } else { + memcpy(&buf[SymlinkHeaderLen], tmp2, cc); + buf[SymlinkHeaderLen + cc] = 0x0; + if (strcmp(buf, p->next->name) != 0) { + printf("symlink %s is not same as recorded value, %s: %s\n", + buf, Force ? "deleting anyway" : "not deleting", tmp); + if (!Force) { + fail = FAIL; + goto pkgdb_cleanup; + } } } }