vfs: check userland buffers before reading them.
[haiku.git] / src / apps / drivesetup / InitParametersPanel.cpp
blobc047bb27e21d5e8b19388441d75e715dd53e9970
1 /*
2 * Copyright 2008-2013 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT license.
5 * Authors:
6 * Stephan Aßmus <superstippi@gmx.de>
7 * Axel Dörfler, axeld@pinc-software.de.
8 * Karsten Heimrich. <host.haiku@gmx.de>
9 */
12 #include "InitParametersPanel.h"
14 #include <driver_settings.h>
15 #include <stdio.h>
17 #include <Button.h>
18 #include <Catalog.h>
21 #undef B_TRANSLATION_CONTEXT
22 #define B_TRANSLATION_CONTEXT "InitializeParametersPanel"
25 InitParametersPanel::InitParametersPanel(BWindow* window,
26 const BString& diskSystem, BPartition* partition)
28 AbstractParametersPanel(window)
30 Init(B_INITIALIZE_PARAMETER_EDITOR, diskSystem, partition);
32 fOkButton->SetLabel(B_TRANSLATE("Initialize"));
36 InitParametersPanel::~InitParametersPanel()
41 status_t
42 InitParametersPanel::Go(BString& name, BString& parameters)
44 status_t status = AbstractParametersPanel::Go(parameters);
45 if (status == B_OK) {
46 void* handle = parse_driver_settings_string(parameters.String());
47 if (handle != NULL) {
48 const char* string = get_driver_parameter(handle, "name",
49 NULL, NULL);
50 name.SetTo(string);
51 delete_driver_settings(handle);
55 return status;