]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Use snprintf(3) in place of unbounded sprintf(3) (prevent buffer overflow).
authorDevin Teske <dteske@FreeBSD.org>
Mon, 29 Sep 2014 00:35:12 +0000 (00:35 +0000)
committerDevin Teske <dteske@FreeBSD.org>
Mon, 29 Sep 2014 00:35:12 +0000 (00:35 +0000)
commit82ac9f2bf78b62e8e164c613d3142e78a0028fe8
tree33a82d186a22e247374a67f0ff40c224defa50e0
parent1aec0f4f91197adae5df4680821a5b6e39959bb5
Use snprintf(3) in place of unbounded sprintf(3) (prevent buffer overflow).
Use adequately sized buffer for error(s) (512 -> PATH_MAX + 512).
Fix the following style(9) nits while here:
- distfetch.c uses PATH_MAX while distextract.c uses MAXPATHLEN;
  standardize on one (PATH_MAX)
- Move $FreeBSD$ from comment to __FBSDID()
- Sort included headers (alphabetically, sys/* at top)
- Add missing header includes (e.g., <stdlib.h> for getenv(3),
  calloc(3)/malloc(3)/free(3), and atoi(3); <string.h> for strdup(3),
  strrchr(3), strsep(3), and strcmp(3); <ctype.h> for isspace(3); and
  <unistd.h> for chdir(2), etc.)
- Remove rogue newline at end of distfetch.c
- Don't declare variables in if-, while-, or other statement
NB: To prevent masking of prior declarations atop function
- Perform stack alignment for variable declarations
- Add missing function prototype for count_files() in distextract.c
- Break out single-line multivariable-declarations
NB: Aligning similarly-named variables with one-char difference(s)
NB: Minimizes diffs and makes future diffs more clear
- Use err(3) family of functions (requires s/int err;/int retval;/g)

Reviewed by: nwhitehorn, julian
usr.sbin/bsdinstall/distextract/distextract.c
usr.sbin/bsdinstall/distfetch/distfetch.c