From: Ted Lemon Date: Tue, 6 Jun 2000 23:51:16 +0000 (+0000) Subject: Fix printf arg causing code to assume uid is NUL-terminated. X-Git-Tag: V3-BETA-2-PATCH-1~169 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=122528527ce2243244182691dddd39672b4a6de5;p=thirdparty%2Fdhcp.git Fix printf arg causing code to assume uid is NUL-terminated. --- diff --git a/server/db.c b/server/db.c index 6b8a3ba23..5a203d637 100644 --- a/server/db.c +++ b/server/db.c @@ -43,7 +43,7 @@ #ifndef lint static char copyright[] = -"$Id: db.c,v 1.51 2000/06/02 21:27:12 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n"; +"$Id: db.c,v 1.52 2000/06/06 23:51:16 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -178,8 +178,8 @@ int write_lease (lease) int i; if (db_printable_len (lease -> uid, lease -> uid_len)) { - fprintf (db_file, "\n uid \"%*s\";", - lease -> uid_len, lease -> uid); + fprintf (db_file, "\n uid \"%.*s\";", + (int)lease -> uid_len, lease -> uid); } else { errno = 0; fprintf (db_file, "\n uid %2.2x", lease -> uid [0]); @@ -354,8 +354,8 @@ int write_host (host) errno = 0; if (db_printable_len (host -> client_identifier.data, host -> client_identifier.len)) { - fprintf (db_file, "\n uid \"%*s\";", - host -> client_identifier.len, + fprintf (db_file, "\n uid \"%.*s\";", + (int)host -> client_identifier.len, host -> client_identifier.data); } else { fprintf (db_file,