summaryrefslogtreecommitdiffstats
path: root/mdk-stage1
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2006-02-15 10:45:44 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2006-02-15 10:45:44 +0000
commite4a78f9f5dfc2d9255d963fd518a5f00cb5c4e3f (patch)
tree18ba7b4133fbbf85b19950758416ee1536c6db8f /mdk-stage1
parentab4a3b36619f5dd7266834f25050302514d1ee90 (diff)
downloaddrakx-backup-do-not-use-e4a78f9f5dfc2d9255d963fd518a5f00cb5c4e3f.tar
drakx-backup-do-not-use-e4a78f9f5dfc2d9255d963fd518a5f00cb5c4e3f.tar.gz
drakx-backup-do-not-use-e4a78f9f5dfc2d9255d963fd518a5f00cb5c4e3f.tar.bz2
drakx-backup-do-not-use-e4a78f9f5dfc2d9255d963fd518a5f00cb5c4e3f.tar.xz
drakx-backup-do-not-use-e4a78f9f5dfc2d9255d963fd518a5f00cb5c4e3f.zip
Fix another couple of potential buffer overflows
Diffstat (limited to 'mdk-stage1')
-rw-r--r--mdk-stage1/tools.c3
-rw-r--r--mdk-stage1/url.c8
2 files changed, 2 insertions, 9 deletions
diff --git a/mdk-stage1/tools.c b/mdk-stage1/tools.c
index 36185bcfb..17a4774fd 100644
--- a/mdk-stage1/tools.c
+++ b/mdk-stage1/tools.c
@@ -451,8 +451,7 @@ int kernel_version(void)
int try_mount(char * dev, char * location)
{
char device_fullname[50];
- strcpy(device_fullname, "/dev/");
- strcat(device_fullname, dev);
+ snprintf(device_fullname, sizeof(device_fullname), "/dev/%s", dev);
if (my_mount(device_fullname, location, "ext2", 0) == -1 &&
my_mount(device_fullname, location, "vfat", 0) == -1 &&
diff --git a/mdk-stage1/url.c b/mdk-stage1/url.c
index ea155419c..808bfd057 100644
--- a/mdk-stage1/url.c
+++ b/mdk-stage1/url.c
@@ -136,13 +136,7 @@ static int ftp_command(int sock, char * command, char * param)
char buf[500];
int rc;
- strcpy(buf, command);
- if (param) {
- strcat(buf, " ");
- strcat(buf, param);
- }
-
- strcat(buf, "\r\n");
+ snprintf(buf, sizeof(buf), "%s%s%s\r\n", command, param ? " " : "", param ? param : "");
if (write(sock, buf, strlen(buf)) != (ssize_t)strlen(buf)) {
return FTPERR_SERVER_IO_ERROR;