diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-01-31 17:57:48 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-01-31 17:57:48 +0000 |
commit | 3038557649ae04860213ab264ff0f647103e5083 (patch) | |
tree | 129ac6598e5dc72b75062249ce7b78725c85c388 | |
parent | 87be316149604ca18613acb1a776ea4ea9f07929 (diff) | |
download | busybox-w32-3038557649ae04860213ab264ff0f647103e5083.tar.gz busybox-w32-3038557649ae04860213ab264ff0f647103e5083.tar.bz2 busybox-w32-3038557649ae04860213ab264ff0f647103e5083.zip |
- bzero -> memset
text data bss dec hex filename
1652855 14444 1215616 2882915 2bfd63 busybox.oorig.gcc-3.3
1652823 14444 1215616 2882883 2bfd43 busybox.gcc-3.3
1603655 14412 1215552 2833619 2b3cd3 busybox.oorig.gcc-3.4
1603655 14412 1215552 2833619 2b3cd3 busybox.gcc-3.4
1609755 14508 1215744 2840007 2b55c7 busybox.oorig.gcc-4.0
1609755 14508 1215744 2840007 2b55c7 busybox.gcc-4.0
1590495 13516 1215392 2819403 2b054b busybox.oorig.gcc-4.1-HEAD
1590495 13516 1215392 2819403 2b054b busybox.gcc-4.1-HEAD
1589079 13036 1213248 2815363 2af583 busybox.oorig.gcc-4.2-HEAD
1589079 13036 1213248 2815363 2af583 busybox.gcc-4.2-HEAD
-rw-r--r-- | libbb/dump.c | 16 | ||||
-rw-r--r-- | loginutils/passwd.c | 33 | ||||
-rw-r--r-- | loginutils/sulogin.c | 17 | ||||
-rw-r--r-- | util-linux/fdisk.c | 4 |
4 files changed, 29 insertions, 41 deletions
diff --git a/libbb/dump.c b/libbb/dump.c index 7d923083a..09db24692 100644 --- a/libbb/dump.c +++ b/libbb/dump.c | |||
@@ -5,19 +5,7 @@ | |||
5 | * Copyright (c) 1989 | 5 | * Copyright (c) 1989 |
6 | * The Regents of the University of California. All rights reserved. | 6 | * The Regents of the University of California. All rights reserved. |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify | 8 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | * General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | * | 9 | * |
22 | * Original copyright notice is retained at the end of this file. | 10 | * Original copyright notice is retained at the end of this file. |
23 | */ | 11 | */ |
@@ -398,7 +386,7 @@ static u_char *get(void) | |||
398 | } | 386 | } |
399 | return ((u_char *) NULL); | 387 | return ((u_char *) NULL); |
400 | } | 388 | } |
401 | bzero((char *) curp + nread, need); | 389 | memset((char *) curp + nread, 0, need); |
402 | eaddress = address + nread; | 390 | eaddress = address + nread; |
403 | return (curp); | 391 | return (curp); |
404 | } | 392 | } |
diff --git a/loginutils/passwd.c b/loginutils/passwd.c index d18cc1e12..c6920ffe7 100644 --- a/loginutils/passwd.c +++ b/loginutils/passwd.c | |||
@@ -45,7 +45,7 @@ static int update_passwd(const struct passwd *pw, const char *crypt_pw) | |||
45 | struct stat sb; | 45 | struct stat sb; |
46 | struct flock lock; | 46 | struct flock lock; |
47 | 47 | ||
48 | #ifdef CONFIG_FEATURE_SHADOWPASSWDS | 48 | #if ENABLE_FEATURE_SHADOWPASSWDS |
49 | if (access(bb_path_shadow_file, F_OK) == 0) { | 49 | if (access(bb_path_shadow_file, F_OK) == 0) { |
50 | snprintf(filename, sizeof filename, "%s", bb_path_shadow_file); | 50 | snprintf(filename, sizeof filename, "%s", bb_path_shadow_file); |
51 | } else | 51 | } else |
@@ -93,8 +93,9 @@ static int update_passwd(const struct passwd *pw, const char *crypt_pw) | |||
93 | rewind(fp); | 93 | rewind(fp); |
94 | while (!feof(fp)) { | 94 | while (!feof(fp)) { |
95 | fgets(buffer, sizeof buffer, fp); | 95 | fgets(buffer, sizeof buffer, fp); |
96 | if (!continued) { // Check to see if we're updating this line. | 96 | if (!continued) { /* Check to see if we're updating this line. */ |
97 | if (strncmp(username, buffer, strlen(username)) == 0) { // we have a match. | 97 | if (strncmp(username, buffer, strlen(username)) == 0) { |
98 | /* we have a match. */ | ||
98 | pw_rest = strchr(buffer, ':'); | 99 | pw_rest = strchr(buffer, ':'); |
99 | *pw_rest++ = '\0'; | 100 | *pw_rest++ = '\0'; |
100 | pw_rest = strchr(pw_rest, ':'); | 101 | pw_rest = strchr(pw_rest, ':'); |
@@ -110,7 +111,7 @@ static int update_passwd(const struct passwd *pw, const char *crypt_pw) | |||
110 | } else { | 111 | } else { |
111 | continued = 1; | 112 | continued = 1; |
112 | } | 113 | } |
113 | bzero(buffer, sizeof buffer); | 114 | memset(buffer, 0, sizeof buffer); |
114 | } | 115 | } |
115 | 116 | ||
116 | if (fflush(out_fp) || fsync(fileno(out_fp)) || fclose(out_fp)) { | 117 | if (fflush(out_fp) || fsync(fileno(out_fp)) || fclose(out_fp)) { |
@@ -145,9 +146,9 @@ extern int passwd_main(int argc, char **argv) | |||
145 | int dflg = 0; /* -d - delete password */ | 146 | int dflg = 0; /* -d - delete password */ |
146 | const struct passwd *pw; | 147 | const struct passwd *pw; |
147 | 148 | ||
148 | #ifdef CONFIG_FEATURE_SHADOWPASSWDS | 149 | #if ENABLE_FEATURE_SHADOWPASSWDS |
149 | const struct spwd *sp; | 150 | const struct spwd *sp; |
150 | #endif /* CONFIG_FEATURE_SHADOWPASSWDS */ | 151 | #endif |
151 | amroot = (getuid() == 0); | 152 | amroot = (getuid() == 0); |
152 | openlog("passwd", LOG_PID | LOG_CONS | LOG_NOWAIT, LOG_AUTH); | 153 | openlog("passwd", LOG_PID | LOG_CONS | LOG_NOWAIT, LOG_AUTH); |
153 | while ((flag = getopt(argc, argv, "a:dlu")) != EOF) { | 154 | while ((flag = getopt(argc, argv, "a:dlu")) != EOF) { |
@@ -186,7 +187,7 @@ extern int passwd_main(int argc, char **argv) | |||
186 | syslog(LOG_WARNING, "can't change pwd for `%s'", name); | 187 | syslog(LOG_WARNING, "can't change pwd for `%s'", name); |
187 | bb_error_msg_and_die("Permission denied.\n"); | 188 | bb_error_msg_and_die("Permission denied.\n"); |
188 | } | 189 | } |
189 | #ifdef CONFIG_FEATURE_SHADOWPASSWDS | 190 | #if ENABLE_FEATURE_SHADOWPASSWDS |
190 | sp = getspnam(name); | 191 | sp = getspnam(name); |
191 | if (!sp) { | 192 | if (!sp) { |
192 | sp = (struct spwd *) pwd_to_spwd(pw); | 193 | sp = (struct spwd *) pwd_to_spwd(pw); |
@@ -196,7 +197,7 @@ extern int passwd_main(int argc, char **argv) | |||
196 | #else | 197 | #else |
197 | cp = pw->pw_passwd; | 198 | cp = pw->pw_passwd; |
198 | np = name; | 199 | np = name; |
199 | #endif /* CONFIG_FEATURE_SHADOWPASSWDS */ | 200 | #endif |
200 | 201 | ||
201 | safe_strncpy(crypt_passwd, cp, sizeof(crypt_passwd)); | 202 | safe_strncpy(crypt_passwd, cp, sizeof(crypt_passwd)); |
202 | if (!(dflg || lflg || uflg)) { | 203 | if (!(dflg || lflg || uflg)) { |
@@ -339,8 +340,8 @@ static int new_password(const struct passwd *pw, int amroot, int algo) | |||
339 | return 1; | 340 | return 1; |
340 | } | 341 | } |
341 | safe_strncpy(orig, clear, sizeof(orig)); | 342 | safe_strncpy(orig, clear, sizeof(orig)); |
342 | bzero(clear, strlen(clear)); | 343 | memset(clear, 0, strlen(clear)); |
343 | bzero(cipher, strlen(cipher)); | 344 | memset(cipher, 0, strlen(cipher)); |
344 | } else { | 345 | } else { |
345 | orig[0] = '\0'; | 346 | orig[0] = '\0'; |
346 | } | 347 | } |
@@ -348,12 +349,12 @@ static int new_password(const struct passwd *pw, int amroot, int algo) | |||
348 | "Please use a combination of upper and lower case letters and numbers.\n" | 349 | "Please use a combination of upper and lower case letters and numbers.\n" |
349 | "Enter new password: "))) | 350 | "Enter new password: "))) |
350 | { | 351 | { |
351 | bzero(orig, sizeof orig); | 352 | memset(orig, 0, sizeof orig); |
352 | /* return -1; */ | 353 | /* return -1; */ |
353 | return 1; | 354 | return 1; |
354 | } | 355 | } |
355 | safe_strncpy(pass, cp, sizeof(pass)); | 356 | safe_strncpy(pass, cp, sizeof(pass)); |
356 | bzero(cp, strlen(cp)); | 357 | memset(cp, 0, strlen(cp)); |
357 | /* if (!obscure(orig, pass, pw)) { */ | 358 | /* if (!obscure(orig, pass, pw)) { */ |
358 | if (obscure(orig, pass, pw)) { | 359 | if (obscure(orig, pass, pw)) { |
359 | if (amroot) { | 360 | if (amroot) { |
@@ -364,7 +365,7 @@ static int new_password(const struct passwd *pw, int amroot, int algo) | |||
364 | } | 365 | } |
365 | } | 366 | } |
366 | if (!(cp = bb_askpass(0, "Re-enter new password: "))) { | 367 | if (!(cp = bb_askpass(0, "Re-enter new password: "))) { |
367 | bzero(orig, sizeof orig); | 368 | memset(orig, 0, sizeof orig); |
368 | /* return -1; */ | 369 | /* return -1; */ |
369 | return 1; | 370 | return 1; |
370 | } | 371 | } |
@@ -373,14 +374,14 @@ static int new_password(const struct passwd *pw, int amroot, int algo) | |||
373 | /* return -1; */ | 374 | /* return -1; */ |
374 | return 1; | 375 | return 1; |
375 | } | 376 | } |
376 | bzero(cp, strlen(cp)); | 377 | memset(cp, 0, strlen(cp)); |
377 | bzero(orig, sizeof(orig)); | 378 | memset(orig, 0, sizeof(orig)); |
378 | 379 | ||
379 | if (algo == 1) { | 380 | if (algo == 1) { |
380 | cp = pw_encrypt(pass, "$1$"); | 381 | cp = pw_encrypt(pass, "$1$"); |
381 | } else | 382 | } else |
382 | cp = pw_encrypt(pass, crypt_make_salt()); | 383 | cp = pw_encrypt(pass, crypt_make_salt()); |
383 | bzero(pass, sizeof pass); | 384 | memset(pass, 0, sizeof pass); |
384 | safe_strncpy(crypt_passwd, cp, sizeof(crypt_passwd)); | 385 | safe_strncpy(crypt_passwd, cp, sizeof(crypt_passwd)); |
385 | return 0; | 386 | return 0; |
386 | } | 387 | } |
diff --git a/loginutils/sulogin.c b/loginutils/sulogin.c index 434683299..cecfa905a 100644 --- a/loginutils/sulogin.c +++ b/loginutils/sulogin.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include "busybox.h" | 17 | #include "busybox.h" |
18 | 18 | ||
19 | 19 | ||
20 | // sulogin defines | ||
21 | #define SULOGIN_PROMPT "\nGive root password for system maintenance\n" \ | 20 | #define SULOGIN_PROMPT "\nGive root password for system maintenance\n" \ |
22 | "(or type Control-D for normal startup):" | 21 | "(or type Control-D for normal startup):" |
23 | 22 | ||
@@ -41,7 +40,7 @@ static const char * const forbid[] = { | |||
41 | 40 | ||
42 | 41 | ||
43 | 42 | ||
44 | static void catchalarm(int junk) | 43 | static void catchalarm(int ATTRIBUTE_UNUSED junk) |
45 | { | 44 | { |
46 | exit(EXIT_FAILURE); | 45 | exit(EXIT_FAILURE); |
47 | } | 46 | } |
@@ -59,9 +58,9 @@ extern int sulogin_main(int argc, char **argv) | |||
59 | struct passwd pwent; | 58 | struct passwd pwent; |
60 | struct passwd *pwd; | 59 | struct passwd *pwd; |
61 | const char * const *p; | 60 | const char * const *p; |
62 | #ifdef CONFIG_FEATURE_SHADOWPASSWDS | 61 | #if ENABLE_FEATURE_SHADOWPASSWDS |
63 | struct spwd *spwd = NULL; | 62 | struct spwd *spwd = NULL; |
64 | #endif /* CONFIG_FEATURE_SHADOWPASSWDS */ | 63 | #endif |
65 | 64 | ||
66 | openlog("sulogin", LOG_PID | LOG_CONS | LOG_NOWAIT, LOG_AUTH); | 65 | openlog("sulogin", LOG_PID | LOG_CONS | LOG_NOWAIT, LOG_AUTH); |
67 | if (argc > 1) { | 66 | if (argc > 1) { |
@@ -114,7 +113,7 @@ extern int sulogin_main(int argc, char **argv) | |||
114 | bb_error_msg_and_die("No password entry for `root'\n"); | 113 | bb_error_msg_and_die("No password entry for `root'\n"); |
115 | } | 114 | } |
116 | pwent = *pwd; | 115 | pwent = *pwd; |
117 | #ifdef CONFIG_FEATURE_SHADOWPASSWDS | 116 | #if ENABLE_FEATURE_SHADOWPASSWDS |
118 | spwd = NULL; | 117 | spwd = NULL; |
119 | if (pwd && ((strcmp(pwd->pw_passwd, "x") == 0) | 118 | if (pwd && ((strcmp(pwd->pw_passwd, "x") == 0) |
120 | || (strcmp(pwd->pw_passwd, "*") == 0))) { | 119 | || (strcmp(pwd->pw_passwd, "*") == 0))) { |
@@ -124,7 +123,7 @@ extern int sulogin_main(int argc, char **argv) | |||
124 | pwent.pw_passwd = spwd->sp_pwdp; | 123 | pwent.pw_passwd = spwd->sp_pwdp; |
125 | } | 124 | } |
126 | } | 125 | } |
127 | #endif /* CONFIG_FEATURE_SHADOWPASSWDS */ | 126 | #endif |
128 | while (1) { | 127 | while (1) { |
129 | cp = bb_askpass(timeout, SULOGIN_PROMPT); | 128 | cp = bb_askpass(timeout, SULOGIN_PROMPT); |
130 | if (!cp || !*cp) { | 129 | if (!cp || !*cp) { |
@@ -134,7 +133,7 @@ extern int sulogin_main(int argc, char **argv) | |||
134 | exit(EXIT_SUCCESS); | 133 | exit(EXIT_SUCCESS); |
135 | } else { | 134 | } else { |
136 | safe_strncpy(pass, cp, sizeof(pass)); | 135 | safe_strncpy(pass, cp, sizeof(pass)); |
137 | bzero(cp, strlen(cp)); | 136 | memset(cp, 0, strlen(cp)); |
138 | } | 137 | } |
139 | if (strcmp(pw_encrypt(pass, pwent.pw_passwd), pwent.pw_passwd) == 0) { | 138 | if (strcmp(pw_encrypt(pass, pwent.pw_passwd), pwent.pw_passwd) == 0) { |
140 | break; | 139 | break; |
@@ -144,13 +143,13 @@ extern int sulogin_main(int argc, char **argv) | |||
144 | fflush(stdout); | 143 | fflush(stdout); |
145 | syslog(LOG_WARNING, "Incorrect root password\n"); | 144 | syslog(LOG_WARNING, "Incorrect root password\n"); |
146 | } | 145 | } |
147 | bzero(pass, strlen(pass)); | 146 | memset(pass, 0, strlen(pass)); |
148 | signal(SIGALRM, SIG_DFL); | 147 | signal(SIGALRM, SIG_DFL); |
149 | puts("Entering System Maintenance Mode\n"); | 148 | puts("Entering System Maintenance Mode\n"); |
150 | fflush(stdout); | 149 | fflush(stdout); |
151 | syslog(LOG_INFO, "System Maintenance Mode\n"); | 150 | syslog(LOG_INFO, "System Maintenance Mode\n"); |
152 | 151 | ||
153 | #ifdef CONFIG_SELINUX | 152 | #if ENABLE_SELINUX |
154 | renew_current_security_context(); | 153 | renew_current_security_context(); |
155 | #endif | 154 | #endif |
156 | 155 | ||
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c index 886b2695b..0514b8935 100644 --- a/util-linux/fdisk.c +++ b/util-linux/fdisk.c | |||
@@ -1342,7 +1342,7 @@ xbsd_write_bootstrap (void) | |||
1342 | bcopy (d, &dl, sizeof (struct xbsd_disklabel)); | 1342 | bcopy (d, &dl, sizeof (struct xbsd_disklabel)); |
1343 | 1343 | ||
1344 | /* The disklabel will be overwritten by 0's from bootxx anyway */ | 1344 | /* The disklabel will be overwritten by 0's from bootxx anyway */ |
1345 | bzero (d, sizeof (struct xbsd_disklabel)); | 1345 | memset (d, 0, sizeof (struct xbsd_disklabel)); |
1346 | 1346 | ||
1347 | snprintf (path, sizeof(path), "%s/boot%s", bootdir, dkbasename); | 1347 | snprintf (path, sizeof(path), "%s/boot%s", bootdir, dkbasename); |
1348 | if (!xbsd_get_bootstrap (path, &disklabelbuffer[xbsd_dlabel.d_secsize], | 1348 | if (!xbsd_get_bootstrap (path, &disklabelbuffer[xbsd_dlabel.d_secsize], |
@@ -1457,7 +1457,7 @@ xbsd_initlabel (struct partition *p, struct xbsd_disklabel *d) { | |||
1457 | struct xbsd_partition *pp; | 1457 | struct xbsd_partition *pp; |
1458 | 1458 | ||
1459 | get_geometry (); | 1459 | get_geometry (); |
1460 | bzero (d, sizeof (struct xbsd_disklabel)); | 1460 | memset (d, 0, sizeof (struct xbsd_disklabel)); |
1461 | 1461 | ||
1462 | d -> d_magic = BSD_DISKMAGIC; | 1462 | d -> d_magic = BSD_DISKMAGIC; |
1463 | 1463 | ||