Commit 2a08b9af authored by Natanael Copa's avatar Natanael Copa
Browse files

main/libc0.9.32: upgrade to new snapshot

parent 5dd0d8ff
From 46db9fdff735edfda088b06d619d23dec2fc3e7a Mon Sep 17 00:00:00 2001
From: Natanael Copa <natanael.copa@gmail.com>
Date: Thu, 16 Sep 2010 08:23:34 +0000
Subject: [PATCH 1/3] config parser: do not assume that realloc return same pointer
We need to update the parser->line pointer on realloc and do not
initialize the token array til after the potensial realloc in
bb_get_chunk_with_continuation().
While here, also replace a realloc() with malloc() where pointer always
is NULL.
Signed-off-by: Natanael Copa <natanael.copa@gmail.com>
---
libc/misc/internals/parse_config.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/libc/misc/internals/parse_config.c b/libc/misc/internals/parse_config.c
index 8fa324e..6734f35 100644
--- a/libc/misc/internals/parse_config.c
+++ b/libc/misc/internals/parse_config.c
@@ -78,6 +78,7 @@ static off_t bb_get_chunk_with_continuation(parser_t* parsr)
parsr->line_len += PAGE_SIZE;
parsr->data = realloc(parsr->data,
parsr->data_len + parsr->line_len);
+ parsr->line = parsr->data + parsr->data_len;
}
}
return pos;
@@ -186,23 +187,21 @@ again:
parser->line_len = 81;
if (parser->data_len == 0)
parser->data_len += 1 + ntokens * sizeof(char *);
- parser->data = realloc(parser->data,
- parser->data_len + parser->line_len);
+ parser->data = malloc(parser->data_len + parser->line_len);
if (parser->data == NULL)
return 0;
parser->allocated |= 1;
} /* else { assert(parser->data_len > 0); } */
if (parser->line == NULL)
parser->line = parser->data + parser->data_len;
- if (*tokens == NULL)
- *tokens = (char **) parser->data;
- memset(*tokens, 0, sizeof(*tokens[0]) * ntokens);
/*config_free_data(parser);*/
/* Read one line (handling continuations with backslash) */
len = bb_get_chunk_with_continuation(parser);
if (len == -1)
return 0;
+ *tokens = (char **) parser->data;
+ memset(*tokens, 0, sizeof(*tokens[0]) * ntokens);
line = parser->line;
/* Skip multiple token-delimiters in the start of line? */
--
1.7.2.3
From 1d1fab81f09e2472921e0b8f1897655de5f9089c Mon Sep 17 00:00:00 2001
From: Natanael Copa <natanael.copa@gmail.com>
Date: Thu, 16 Sep 2010 11:37:39 +0000
Subject: [PATCH 2/3] getservice: getservent_r must return ERANGE when buffer is too small
This fixes issue introduced by 72e1a1ce186c39f07282398e2af9eb0253e60f15
This should also fix the following testcase to exit with error rather
than cause an endless loop.
int main(void) {
if (getservbyname("non-existing", "udp") == NULL)
err(1, "getservbyname");
return 0;
}
Reported by Pirmin Walthert
http://lists.uclibc.org/pipermail/uclibc/2010-August/044277.html
Signed-off-by: Natanael Copa <natanael.copa@gmail.com>
---
libc/inet/getservice.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/libc/inet/getservice.c b/libc/inet/getservice.c
index 1532df9..ccf9816 100644
--- a/libc/inet/getservice.c
+++ b/libc/inet/getservice.c
@@ -69,7 +69,7 @@ int getservent_r(struct servent *result_buf,
char **serv_aliases;
char **tok = NULL;
const size_t aliaslen = sizeof(*serv_aliases) * MAXALIASES;
- int ret = ENOENT;
+ int ret = ERANGE;
*result = NULL;
if (buflen < aliaslen
@@ -77,7 +77,7 @@ int getservent_r(struct servent *result_buf,
goto DONE_NOUNLOCK;
__UCLIBC_MUTEX_LOCK(mylock);
-
+ ret = ENOENT;
if (servp == NULL)
setservent(serv_stayopen);
if (servp == NULL)
@@ -88,7 +88,6 @@ int getservent_r(struct servent *result_buf,
servp->line_len = buflen - aliaslen;
/* <name>[[:space:]]<port>/<proto>[[:space:]][<aliases>] */
if (!config_read(servp, &tok, MAXALIASES, 3, "# \t/", PARSE_NORMAL)) {
- ret = ERANGE;
goto DONE;
}
result_buf->s_name = *(tok++);
--
1.7.2.3
From 1f134a1d5456148e212dbe6eb69ce7bee11dc1fb Mon Sep 17 00:00:00 2001
From: Natanael Copa <natanael.copa@gmail.com>
Date: Thu, 16 Sep 2010 11:51:21 +0000
Subject: [PATCH 3/3] config parser: always initialize line pointer
We must always initialize line pointer since data pointer might
have changed due to a realloc (in getserv.c for example).
Signed-off-by: Natanael Copa <natanael.copa@gmail.com>
---
libc/misc/internals/parse_config.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/libc/misc/internals/parse_config.c b/libc/misc/internals/parse_config.c
index 6734f35..6d3b6f4 100644
--- a/libc/misc/internals/parse_config.c
+++ b/libc/misc/internals/parse_config.c
@@ -192,8 +192,7 @@ again:
return 0;
parser->allocated |= 1;
} /* else { assert(parser->data_len > 0); } */
- if (parser->line == NULL)
- parser->line = parser->data + parser->data_len;
+ parser->line = parser->data + parser->data_len;
/*config_free_data(parser);*/
/* Read one line (handling continuations with backslash) */
--
1.7.2.3
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
_abiver=0.9.32
pkgname=libc$_abiver
_gitver=1009151331
_gitver=1010161651
pkgver=${_abiver}_alpha0_git$_gitver
pkgrel=2
pkgrel=0
pkgdesc="C library for developing embedded Linux systems"
url=http://uclibc.org
license="LGPL-2"
......@@ -22,12 +22,6 @@ source="http://build.alpinelinux.org:8010/distfiles/$_snapfile
compat-stack-guard.patch
uclibc-libm-pic.patch
0001-create-DEVEL_PREFIX-MULTILIB_DIR-dir-rather-than-DEV.patch
0001-config-parser-do-not-assume-that-realloc-return-same.patch
0002-getservice-getservent_r-must-return-ERANGE-when-buff.patch
0003-config-parser-always-initialize-line-pointer.patch
bufsize.patch
uclibcconfig.x86
uclibcconfig.i486
"
......@@ -116,13 +110,9 @@ utils() {
mv "$pkgdir"/usr/bin/* "$subpkgdir"/usr/bin/
}
md5sums="966c830f294a8ab5069cc03a61e1b2ed libc0.9.32-0.9.32_alpha0_git1009151331.tar.bz2
md5sums="02ab241c13849911695c31b01f98a73e libc0.9.32-0.9.32_alpha0_git1010161651.tar.bz2
4d408f72142ce55a0754948cc9cfe447 compat-stack-guard.patch
2f9739a980be24a842c57516155c7885 uclibc-libm-pic.patch
9dd8192227f54d6d3ccb49dc54137ff3 0001-create-DEVEL_PREFIX-MULTILIB_DIR-dir-rather-than-DEV.patch
ba6e0370d1fc19e5903696de412507ef 0001-config-parser-do-not-assume-that-realloc-return-same.patch
19d923997f9625ce6f16d8128bbcba65 0002-getservice-getservent_r-must-return-ERANGE-when-buff.patch
99b817778f4ef3a1b194740ea08990b4 0003-config-parser-always-initialize-line-pointer.patch
cf97d904c42c5fd165650472100b18a7 bufsize.patch
cffecb42bdec2da7cac718fa66cacbbe uclibcconfig.x86
cffecb42bdec2da7cac718fa66cacbbe uclibcconfig.i486"
diff --git a/libc/inet/getproto.c b/libc/inet/getproto.c
index bcf507b..9858900 100644
--- a/libc/inet/getproto.c
+++ b/libc/inet/getproto.c
@@ -28,7 +28,7 @@ aliases: case sensitive optional space or tab separated list of other names
__UCLIBC_MUTEX_STATIC(mylock, PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP);
#define MAXALIASES 35
-#define BUFSZ (80) /* one line */
+#define BUFSZ (256) /* one line */
#define SBUFSIZE (BUFSZ + 1 + (sizeof(char *) * MAXALIASES))
static parser_t *protop = NULL;
diff --git a/libc/inet/getservice.c b/libc/inet/getservice.c
index c38ff80..dbbc19c 100644
--- a/libc/inet/getservice.c
+++ b/libc/inet/getservice.c
@@ -29,7 +29,7 @@ aliases: case sensitive optional space or tab separated list of other names
__UCLIBC_MUTEX_STATIC(mylock, PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP);
#define MAXALIASES 35
-#define BUFSZ (80) /* one line */
+#define BUFSZ (256) /* one line */
#define SBUFSIZE (BUFSZ + 1 + (sizeof(char *) * MAXALIASES))
static parser_t *servp = NULL;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment