提交 20c5374b 编写于 作者: D dchuyko

8220072: GCC 8.3 reports errors in java.base

Reviewed-by: rriggs
上级 3f3326b2
/*
* Copyright (c) 1994, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -211,11 +211,10 @@ canonicalize(char *original, char *resolved, int len)
char *p, *end, *r = NULL;
char path[PATH_MAX + 1];
strncpy(path, original, sizeof(path));
if (path[PATH_MAX] != '\0') {
errno = ENAMETOOLONG;
return -1;
}
// strlen(original) <= PATH_MAX, see above
strncpy(path, original, PATH_MAX);
// append null for == case
path[PATH_MAX] = '\0';
end = path + strlen(path);
for (p = end; p > path;) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册