Source-Changes-HG archive

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

[src/trunk]: src/external/bsd/pkg_install/dist/lib Don't try to memcpy (size_...



details:   https://anonhg.NetBSD.org/src/rev/9716bfe98b55
branches:  trunk
changeset: 957838:9716bfe98b55
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Dec 12 18:19:34 2020 +0000

description:
Don't try to memcpy (size_t)-1 bytes!

diffstat:

 external/bsd/pkg_install/dist/lib/plist.c |  23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)

diffs (44 lines):

diff -r 4b98a4acc2da -r 9716bfe98b55 external/bsd/pkg_install/dist/lib/plist.c
--- a/external/bsd/pkg_install/dist/lib/plist.c Sat Dec 12 18:11:42 2020 +0000
+++ b/external/bsd/pkg_install/dist/lib/plist.c Sat Dec 12 18:19:34 2020 +0000
@@ -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 @@
                                                                        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;
+                                                                       }
                                                                }
                                                        }
                                                }



Home | Main Index | Thread Index | Old Index