patch XNS code to be like INET code
authorJohn Kohl <jtkohl@mit.edu>
Wed, 30 May 1990 15:34:00 +0000 (15:34 +0000)
committerJohn Kohl <jtkohl@mit.edu>
Wed, 30 May 1990 15:34:00 +0000 (15:34 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@966 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/os/localaddr.c

index fcd7be8620d67bf30921af7b2c0a19f9887e8238..68bc749f958ad436fdc9916801eb6199bbfca95b 100644 (file)
@@ -162,8 +162,17 @@ krb5_error_code krb5_os_localaddr(addr)
                    /* XXX should we perhaps use ns_host instead? */
 
                    address->length = sizeof(struct ns_addr);
-                   memcpy ((char *)address->contents, (char *)&ns->sns_addr,
-                           address->length);
+                   address->contents = (unsigned char *)malloc(address->length);
+                   if (!address->contents) {
+                       free((char *)address);
+                       address = 0;
+                       mem_err++;
+                   } else {
+                       memcpy ((char *)address->contents,
+                               (char *)&ns->sns_addr,
+                               address->length);
+                       break;
+                   }
                } else mem_err++;
                break;
            }