From 500431077b5a8e9ba1af3e2cb87bae5d4701c799 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 30 Sep 2009 20:32:18 +0000 Subject: Apple opensource patches suggested by Jun T. in 27300 --- Src/utils.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Src/utils.c') diff --git a/Src/utils.c b/Src/utils.c index b807eea08..230951ffc 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -3427,8 +3427,11 @@ spname(char *oldname) * otherwise a copy of oldname with a corrected prefix is returned. * * Rationale for this, if there ever was any, has been forgotten. */ for (;;) { - while (*old == '/') + while (*old == '/') { + if ((new - newname) >= (sizeof(newname)-1)) + return NULL; *new++ = *old++; + } *new = '\0'; if (*old == '\0') return newname; -- cgit 1.4.1