RFR 8198302: VS2017 (C4477) java.base/windows/native/libnet/NetworkInterface_winXP.c incorrect printf format strings

Roger Riggs Roger.Riggs at Oracle.com
Tue Mar 6 16:06:10 UTC 2018


+1

On 3/6/2018 10:57 AM, Langer, Christoph wrote:
>
> Looks good, Brian.
>
> *From:*net-dev [mailto:net-dev-bounces at openjdk.java.net] *On Behalf Of 
> *Brian Burkhalter
> *Sent:* Dienstag, 6. März 2018 16:27
> *To:* OpenJDK Network Dev list <net-dev at openjdk.java.net>
> *Subject:* RFR 8198302: VS2017 (C4477) 
> java.base/windows/native/libnet/NetworkInterface_winXP.c incorrect 
> printf format strings
>
> https://bugs.openjdk.java.net/browse/JDK-8198302
>
> Changes are in the diff below.
>
> Thanks,
>
> Brian
>
> --- a/src/java.base/windows/native/libnet/NetworkInterface_winXP.c
>
> +++ b/src/java.base/windows/native/libnet/NetworkInterface_winXP.c
>
> @@ -1,5 +1,5 @@
>
>  /*
>
> - * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights 
> reserved.
>
> + * Copyright (c) 2003, 2018, 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
>
> @@ -39,14 +39,15 @@
>
>  #ifdef DEBUG
>
>  void printnif (netif *nif) {
>
>  #ifdef _WIN64
>
> -       printf ("nif:0x%I64x name:%s\n", nif,nif->name);
>
> +       printf ("nif:0x%I64x name:%s\n", (UINT_PTR)nif, nif->name);
>
>  #else
>
> -       printf ("nif:0x%x name:%s\n", nif,nif->name);
>
> +       printf ("nif:0x%x name:%s\n", nif, nif->name);
>
>  #endif
>
>       if (nif->dNameIsUnicode) {
>
> -           printf ("dName:%S index:%d ", nif->displayName,nif->index);
>
> +           printf ("dName:%S index:%d ", (unsigned short 
> *)nif->displayName,
>
> +               nif->index);
>
>       } else {
>
> -           printf ("dName:%s index:%d ", nif->displayName,nif->index);
>
> +           printf ("dName:%s index:%d ", nif->displayName, nif->index);
>
>       }
>
>       printf ("naddrs:%d\n", nif->naddrs);
>
>  }
>



More information about the net-dev mailing list