summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/thirdparty.c
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2006-02-15 11:30:33 +0000
committerOlivier Blin <oblin@mandriva.org>2006-02-15 11:30:33 +0000
commitd79f0463ccbf3e9b1f75de69f985427a1def0e44 (patch)
treef9632e40532c5da962fef044d13be19ab24ac4a1 /mdk-stage1/thirdparty.c
parentab82acfb66d16f6eb9059d8c276c3a8770d196b5 (diff)
downloaddrakx-d79f0463ccbf3e9b1f75de69f985427a1def0e44.tar
drakx-d79f0463ccbf3e9b1f75de69f985427a1def0e44.tar.gz
drakx-d79f0463ccbf3e9b1f75de69f985427a1def0e44.tar.bz2
drakx-d79f0463ccbf3e9b1f75de69f985427a1def0e44.tar.xz
drakx-d79f0463ccbf3e9b1f75de69f985427a1def0e44.zip
fix potential buffer overflows (thanks to Rafael for the advice)
Diffstat (limited to 'mdk-stage1/thirdparty.c')
-rw-r--r--mdk-stage1/thirdparty.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/mdk-stage1/thirdparty.c b/mdk-stage1/thirdparty.c
index f6b694707..f5dac2808 100644
--- a/mdk-stage1/thirdparty.c
+++ b/mdk-stage1/thirdparty.c
@@ -320,8 +320,7 @@ static enum return_type thirdparty_try_directory(char * root_directory, int inte
struct utsname kernel_uname;
/* look first in the specific third-party directory */
- strcpy(modules_location, root_directory);
- strcat(modules_location, THIRDPARTY_DIRECTORY);
+ snprintf(modules_location, sizeof(modules_location), "%s" THIRDPARTY_DIRECTORY, root_directory);
modules_list = list_directory(modules_location);
/* if it's empty, look in the root of selected device */
@@ -339,9 +338,7 @@ static enum return_type thirdparty_try_directory(char * root_directory, int inte
log_perror("uname failed");
return RETURN_ERROR;
}
- strcpy(modules_location_release, modules_location);
- strcat(modules_location_release, "/");
- strcat(modules_location_release, kernel_uname.release);
+ snprintf(modules_location_release, sizeof(modules_location_release), "%s/%s", modules_location, kernel_uname.release);
modules_list_release = list_directory(modules_location_release);
if (modules_list_release && modules_list_release[0]) {
strcpy(modules_location, modules_location_release);