Bug 13892 - getline() doesn't expect *n to be random
getline() doesn't expect *n to be random
Status: NEW
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Build
: P5 normal
: ---
Assigned To: Karolin Seeger
Samba QA Contact
Depends on:
  Show dependency treegraph
Reported: 2019-04-09 10:35 UTC by Stefan Metzmacher
Modified: 2019-04-18 06:09 UTC (History)
2 users (show)

See Also:

Patch (1.52 KB, patch)
2019-04-09 10:53 UTC, Volker Lendecke
no flags Details
Patch (1.75 KB, patch)
2019-04-09 11:18 UTC, Volker Lendecke
no flags Details
Patch for v4-10-test (1.08 KB, patch)
2019-04-17 21:12 UTC, Stefan Metzmacher
vl: review+

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Metzmacher 2019-04-09 10:35:32 UTC
We should not pass an uninitialized len as *n.

At least on aix7 getline(*lineptr=NULL, *n=3622720148, ...)
returns -1 with errno=ENOMEM.
Comment 1 Volker Lendecke 2019-04-09 10:53:43 UTC
Created attachment 15053 [details]

Two patches: One pure bugfix, another one to initialize the other variables
Comment 2 Volker Lendecke 2019-04-09 11:18:46 UTC
Created attachment 15054 [details]

Implement metze's hint to take "len" out of the loop
Comment 3 Stefan Metzmacher 2019-04-17 21:12:09 UTC
Created attachment 15078 [details]
Patch for v4-10-test