8308801: update for deprecated sprintf for libnet in java.base
Reviewed-by: djelinski, rriggs
This commit is contained in:
parent
77c5adb09e
commit
c72b547425
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -1266,7 +1266,7 @@ static netif *enumIPv6Interfaces(JNIEnv *env, int sock, netif *ifs) {
|
|||||||
char addr6[40];
|
char addr6[40];
|
||||||
struct sockaddr_in6 addr;
|
struct sockaddr_in6 addr;
|
||||||
|
|
||||||
sprintf(addr6, "%s:%s:%s:%s:%s:%s:%s:%s",
|
snprintf(addr6, sizeof(addr6), "%s:%s:%s:%s:%s:%s:%s:%s",
|
||||||
addr6p[0], addr6p[1], addr6p[2], addr6p[3],
|
addr6p[0], addr6p[1], addr6p[2], addr6p[3],
|
||||||
addr6p[4], addr6p[5], addr6p[6], addr6p[7]);
|
addr6p[4], addr6p[5], addr6p[6], addr6p[7]);
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -197,7 +197,7 @@ void NET_ThrowUnknownHostExceptionWithGaiError(JNIEnv *env,
|
|||||||
buf = (char *) malloc(size);
|
buf = (char *) malloc(size);
|
||||||
if (buf) {
|
if (buf) {
|
||||||
jstring s;
|
jstring s;
|
||||||
sprintf(buf, format, hostname, error_string);
|
snprintf(buf, size, format, hostname, error_string);
|
||||||
s = JNU_NewStringPlatform(env, buf);
|
s = JNU_NewStringPlatform(env, buf);
|
||||||
if (s != NULL) {
|
if (s != NULL) {
|
||||||
jobject x = JNU_NewObjectByName(env,
|
jobject x = JNU_NewObjectByName(env,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -187,7 +187,7 @@ NET_ThrowNew(JNIEnv *env, int errorNum, char *msg)
|
|||||||
if (excP == NULL) {
|
if (excP == NULL) {
|
||||||
excP = "SocketException";
|
excP = "SocketException";
|
||||||
}
|
}
|
||||||
sprintf(exc, "%s%s", JNU_JAVANETPKG, excP);
|
snprintf(exc, sizeof(exc), "%s%s", JNU_JAVANETPKG, excP);
|
||||||
JNU_ThrowByName(env, exc, fullMsg);
|
JNU_ThrowByName(env, exc, fullMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user