mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-18 14:40:06 +00:00
[BZ #6654]
2008-06-25 Ulrich Drepper <drepper@redhat.com> [BZ #6654] * stdlib/canonicalize.c (__realpath): readlink can write too much into the buffer on platforms without PATH_MAX.
This commit is contained in:
parent
4cb8e687af
commit
104426b654
@ -1,3 +1,9 @@
|
|||||||
|
2008-06-25 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
[BZ #6654]
|
||||||
|
* stdlib/canonicalize.c (__realpath): readlink can write too much
|
||||||
|
into the buffer on platforms without PATH_MAX.
|
||||||
|
|
||||||
2008-06-17 Carlos O'Donell <carlos@codesourcery.com>
|
2008-06-17 Carlos O'Donell <carlos@codesourcery.com>
|
||||||
|
|
||||||
[BZ #6653]
|
[BZ #6653]
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
2008-06-25 Ulrich Drepper <drepper@redhat.com>
|
2008-06-25 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* tst-strptime.c (do_test): Add test for parsing era year
|
||||||
|
representation.
|
||||||
|
|
||||||
[BZ #5911]
|
[BZ #5911]
|
||||||
* locales/es_CR: Define first_weekday and first_workday.
|
* locales/es_CR: Define first_weekday and first_workday.
|
||||||
|
|
||||||
|
@ -1,22 +1,43 @@
|
|||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
static int
|
static int
|
||||||
do_test (void)
|
do_test (void)
|
||||||
{
|
{
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
if (setlocale (LC_ALL, "vi_VN.TCVN5712-1") == NULL)
|
if (setlocale (LC_ALL, "vi_VN.TCVN5712-1") == NULL)
|
||||||
{
|
{
|
||||||
puts ("cannot set locale");
|
puts ("cannot set locale");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
|
memset (&tm, '\0', sizeof (tm));
|
||||||
/* This is November in Vietnamese encoded using TCVN5712-1. */
|
/* This is November in Vietnamese encoded using TCVN5712-1. */
|
||||||
static const char s[] = "\
|
static const char s[] = "\
|
||||||
\x54\x68\xb8\x6e\x67\x20\x6d\xad\xea\x69\x20\x6d\xe9\x74";
|
\x54\x68\xb8\x6e\x67\x20\x6d\xad\xea\x69\x20\x6d\xe9\x74\0";
|
||||||
char *r = strptime (s, "%b", &tm);
|
char *r = strptime (s, "%b", &tm);
|
||||||
printf ("r = %p, r-s = %tu, tm.tm_mon = %d\n", r, r - s, tm.tm_mon);
|
printf ("r = %p, r-s = %tu, tm.tm_mon = %d\n", r, r - s, tm.tm_mon);
|
||||||
return r == NULL || r - s != 14 || tm.tm_mon != 10;
|
result = r == NULL || r - s != 14 || tm.tm_mon != 10;
|
||||||
|
|
||||||
|
if (setlocale (LC_ALL, "ja_JP.UTF-8") == NULL)
|
||||||
|
{
|
||||||
|
puts ("cannot set locale");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
static const char s2[] = "\
|
||||||
|
\x32\x35\x20\x30\x36\x20\xe5\xb9\xb3\xe6\x88\x90\x32\x30\0";
|
||||||
|
memset (&tm, '\0', sizeof (tm));
|
||||||
|
r = strptime (s2, "%d %m %EC%Ey", &tm);
|
||||||
|
printf ("\
|
||||||
|
r = %p, r-s2 = %tu, tm.tm_mday = %d, tm.tm_mon = %d, tm.tm_year = %d\n",
|
||||||
|
r, r - s2, tm.tm_mday, tm.tm_mon, tm.tm_year);
|
||||||
|
result = (r == NULL || r - s2 != 14 || tm.tm_mday != 25 || tm.tm_mon != 5
|
||||||
|
|| tm.tm_year != 108);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define TEST_FUNCTION do_test ()
|
#define TEST_FUNCTION do_test ()
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Return the canonical absolute name of a given file.
|
/* Return the canonical absolute name of a given file.
|
||||||
Copyright (C) 1996-2002, 2004, 2005, 2006 Free Software Foundation, Inc.
|
Copyright (C) 1996-2002,2004,2005,2006,2008 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -173,7 +173,7 @@ __realpath (const char *name, char *resolved)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
n = __readlink (rpath, buf, path_max);
|
n = __readlink (rpath, buf, path_max - 1);
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
goto error;
|
goto error;
|
||||||
buf[n] = '\0';
|
buf[n] = '\0';
|
||||||
|
Loading…
Reference in New Issue
Block a user