summaryrefslogtreecommitdiff
path: root/src/basic
diff options
context:
space:
mode:
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/terminal-util.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/basic/terminal-util.c b/src/basic/terminal-util.c
index a1a789984f..b692c52e59 100644
--- a/src/basic/terminal-util.c
+++ b/src/basic/terminal-util.c
@@ -1041,6 +1041,10 @@ int ptsname_malloc(int fd, char **ret) {
}
free(c);
+
+ if (l > SIZE_MAX / 2)
+ return -ENOMEM;
+
l *= 2;
}
}