浏览代码

getservbyport_r: fix wrong result if getnameinfo fails with EAI_OVERFLOW

EAI_OVERFLOW should be propagated as ERANGE to inform the caller about
the need to expand the buffer.
Alexey Izbyshev 2 年之前
父节点
当前提交
b1dfb734a4
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      src/network/getservbyport_r.c

+ 2 - 0
src/network/getservbyport_r.c

@@ -46,6 +46,8 @@ int getservbyport_r(int port, const char *prots,
 	case EAI_MEMORY:
 	case EAI_SYSTEM:
 		return ENOMEM;
+	case EAI_OVERFLOW:
+		return ERANGE;
 	default:
 		return ENOENT;
 	case 0: