Do not call principal_ntoh to copy ktc_principal structs
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Wed, 22 Jul 2009 21:40:13 +0000 (22:40 +0100)
committerDerrick Brashear <shadow@dementia.org>
Thu, 23 Jul 2009 17:34:25 +0000 (10:34 -0700)
principal_ntoh() is designed for butc_principal structures, which are a
different size from ktc_principal structures, and so it can't be used to
copy them.

Reviewed-on: http://gerrit.openafs.org/http://gerrit.openafs.org/185
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

src/budb/struct_ops.c

index 63ef1ff..9a5c4ff 100644 (file)
@@ -363,9 +363,12 @@ dump_ntoh(struct dump *netDumpPtr,
 {
     hostDumpPtr->id = ntohl(netDumpPtr->id);
     hostDumpPtr->idHashChain = ntohl(netDumpPtr->idHashChain);
-    strcpy(hostDumpPtr->dumpName, netDumpPtr->dumpName);
-    strcpy(hostDumpPtr->dumpPath, netDumpPtr->dumpPath);
-    strcpy(hostDumpPtr->volumeSet, netDumpPtr->volumeSet);
+    strlcpy(hostDumpPtr->dumpName, netDumpPtr->dumpName, 
+           sizeof(hostDumpPtr->dumpName));
+    strlcpy(hostDumpPtr->dumpPath, netDumpPtr->dumpPath,
+           sizeof(hostDumpPtr->dumpPath));
+    strlcpy(hostDumpPtr->volumeSet, netDumpPtr->volumeSet,
+           sizeof(hostDumpPtr->volumeSet));
     hostDumpPtr->nameHashChain = ntohl(netDumpPtr->nameHashChain);
     hostDumpPtr->flags = ntohl(netDumpPtr->flags);
     hostDumpPtr->parent = ntohl(netDumpPtr->parent);
@@ -377,7 +380,7 @@ dump_ntoh(struct dump *netDumpPtr,
 
     hostDumpPtr->firstTape = ntohl(netDumpPtr->firstTape);
 
-    principal_ntoh(&netDumpPtr->dumper, &hostDumpPtr->dumper);
+    hostDumpPtr->dumper = netDumpPtr->dumper;
 }
 
 void