X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/8ad349bb6ed4a0be06e34c92be0d98b92e078db4..2d21ac55c334faf3a56e5634905ed6987fc787d4:/osfmk/ddb/db_macro.c diff --git a/osfmk/ddb/db_macro.c b/osfmk/ddb/db_macro.c index 19c210e27..9e9e6cf98 100644 --- a/osfmk/ddb/db_macro.c +++ b/osfmk/ddb/db_macro.c @@ -1,31 +1,29 @@ /* - * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved. * - * @APPLE_LICENSE_OSREFERENCE_HEADER_START@ + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the - * License may not be used to create, or enable the creation or - * redistribution of, unlawful or unlicensed copies of an Apple operating - * system, or to circumvent, violate, or enable the circumvention or - * violation of, any terms of an Apple operating system software license - * agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and * limitations under the License. - * - * @APPLE_LICENSE_OSREFERENCE_HEADER_END@ + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /* * @OSF_COPYRIGHT@ @@ -58,7 +56,7 @@ /* */ #include -#include /* For strcmp(), strcpy() */ +#include /* For strncmp(), strlcpy() */ #include #include @@ -99,7 +97,7 @@ db_lookup_macro(char *name) for (mp = db_user_macro; mp < &db_user_macro[DB_NUSER_MACRO]; mp++) { if (mp->m_name[0] == 0) continue; - if (strcmp(mp->m_name, name) == 0) + if (strncmp(mp->m_name, name, TOK_STRING_SIZE) == 0) return(mp); } return(0); @@ -127,7 +125,7 @@ db_def_macro_cmd(void) db_error("ddb: internal error(macro)\n"); /* NOTREACHED */ db_macro_free--; - strcpy(mp->m_name, db_tok_string); + strlcpy(mp->m_name, db_tok_string, TOK_STRING_SIZE); } for (c = db_read_char(); c == ' ' || c == '\t'; c = db_read_char()); for (p = mp->m_lbuf; c > 0; c = db_read_char()) @@ -139,7 +137,7 @@ db_def_macro_cmd(void) void db_del_macro_cmd(void) { - register struct db_user_macro *mp; + struct db_user_macro *mp = NULL; if (db_read_token() != tIDENT || (mp = db_lookup_macro(db_tok_string)) == 0) { @@ -165,7 +163,7 @@ db_show_macro(void) for (mp = db_user_macro; mp < &db_user_macro[DB_NUSER_MACRO]; mp++) { if (mp->m_name[0] == 0) continue; - if (name && strcmp(mp->m_name, name)) + if (name && strncmp(mp->m_name, name, TOK_STRING_SIZE)) continue; db_printf("%s: %s", mp->m_name, mp->m_lbuf); } @@ -197,11 +195,8 @@ db_exec_macro(char *name) } int -db_arg_variable( - struct db_variable *vp, - db_expr_t *valuep, - int flag, - db_var_aux_param_t ap) +db_arg_variable(__unused struct db_variable *vp, db_expr_t *valuep, int flag, + db_var_aux_param_t ap) { db_expr_t value; char *name;