]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/basic/terminal-util.c
terminal-util: add paranoid overflow check
[thirdparty/systemd.git] / src / basic / terminal-util.c
index a1a789984f001354dd575dea7d67e24bb28fa525..b692c52e590f0829b04e8b6bdf501552043b3da0 100644 (file)
@@ -1041,6 +1041,10 @@ int ptsname_malloc(int fd, char **ret) {
                 }
 
                 free(c);
+
+                if (l > SIZE_MAX / 2)
+                        return -ENOMEM;
+
                 l *= 2;
         }
 }