summaryrefslogtreecommitdiff
path: root/Src/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/utils.c')
-rw-r--r--Src/utils.c5
1 files changed, 4 insertions, 1 deletions
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;