summaryrefslogtreecommitdiff
path: root/osunixxf.c
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2011-05-31 17:33:30 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2011-05-31 17:33:30 +0000
commiteb16cf140e9ac2743140a477895264ce7dd69ec0 (patch)
treea4b5e9ea11023a137a0c3714f61e913e6ee89686 /osunixxf.c
parent848049e223ef408a308cd85e7784b4ea4bc6e54a (diff)
Diffstat (limited to 'osunixxf.c')
-rw-r--r--osunixxf.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/osunixxf.c b/osunixxf.c
index 8a23d3635b72..434e5fe1a41e 100644
--- a/osunixxf.c
+++ b/osunixxf.c
@@ -311,18 +311,21 @@ AcpiOsVprintf (
*
* FUNCTION: AcpiOsGetLine
*
- * PARAMETERS: fmt - Standard printf format
- * args - Argument list
+ * PARAMETERS: Buffer - Where to return the command line
+ * BufferLength - Maximum length of Buffer
+ * BytesRead - Where the actual byte count is returned
*
- * RETURN: Actual bytes read
+ * RETURN: Status and actual bytes read
*
* DESCRIPTION: Formatted input with argument list pointer
*
*****************************************************************************/
-UINT32
+ACPI_STATUS
AcpiOsGetLine (
- char *Buffer)
+ char *Buffer,
+ UINT32 BufferLength,
+ UINT32 *BytesRead)
{
UINT8 Temp;
UINT32 i;
@@ -330,6 +333,11 @@ AcpiOsGetLine (
for (i = 0; ; i++)
{
+ if (i >= BufferLength)
+ {
+ return (AE_BUFFER_OVERFLOW);
+ }
+
scanf ("%1c", &Temp);
if (!Temp || Temp == '\n')
{
@@ -345,7 +353,11 @@ AcpiOsGetLine (
/* Return the number of bytes in the string */
- return (i);
+ if (BytesRead)
+ {
+ *BytesRead = i;
+ }
+ return (AE_OK);
}