Skip to content

Commit

Permalink
pkg_install: carry over bugfix from src
Browse files Browse the repository at this point in the history
christos: Don't try to memcpy (size_t)-1 bytes!
  • Loading branch information
0-wiz-0 committed Dec 12, 2020
1 parent bb0eea6 commit 8655239
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions pkgtools/pkg_install/files/lib/plist.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $NetBSD: plist.c,v 1.31 2020/09/07 23:46:42 wiz Exp $ */
/* $NetBSD: plist.c,v 1.32 2020/12/12 19:25:19 wiz Exp $ */

#if HAVE_CONFIG_H
#include "config.h"
Expand All @@ -7,7 +7,7 @@
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
__RCSID("$NetBSD: plist.c,v 1.31 2020/09/07 23:46:42 wiz Exp $");
__RCSID("$NetBSD: plist.c,v 1.32 2020/12/12 19:25:19 wiz Exp $");

/*
* FreeBSD install - a package for the installation and maintainance
Expand Down Expand Up @@ -637,15 +637,16 @@ delete_package(Boolean ign_err, package_t *pkg, Boolean NoDeleteFiles,
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;
}
}
}
}
Expand Down

0 comments on commit 8655239

Please sign in to comment.