ObjFW  Check-in [99862df65a]

Overview
Comment:Fix fallback asprintf implementation for length 0
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 99862df65a9de1c9138f11449c99b9e6aed1ed85bd491942b88f02f71b9efa76
User & Date: js on 2021-01-14 01:45:04
Other Links: manifest | tags
Context
2021-01-14
02:29
Define _HPUX_ALT_XOPEN_SOCKET_API where necessary check-in: 1833194867 user: js tags: trunk
01:45
Fix fallback asprintf implementation for length 0 check-in: 99862df65a user: js tags: trunk
01:27
Disable _Unwind_Backtrace() on HP-UX check-in: 9a5d1024a0 user: js tags: trunk
Changes

Modified src/of_asprintf.m from [f0147f7049] to [489f8ebee0].

106
107
108
109
110
111
112
113
114
115
116
117
118
119
120

		if ((*string = malloc(bufferLength)) == NULL)
			return -1;

		length = vsnprintf(*string, bufferLength - 1, format,
		    arguments);

		if (length > 0 && (size_t)length < bufferLength - 1)
			break;

		if (bufferLength > INT_MAX / 2) {
			free(*string);
			return -1;
		}








|







106
107
108
109
110
111
112
113
114
115
116
117
118
119
120

		if ((*string = malloc(bufferLength)) == NULL)
			return -1;

		length = vsnprintf(*string, bufferLength - 1, format,
		    arguments);

		if (length >= 0 && (size_t)length < bufferLength - 1)
			break;

		if (bufferLength > INT_MAX / 2) {
			free(*string);
			return -1;
		}