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

See Also:


Attachments
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+
Details

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]
Patch

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]
Patch

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
Comment 4 Karolin Seeger 2019-05-16 10:07:28 UTC
(In reply to Stefan Metzmacher from comment #3)
Pushed to autobuild-v4-10-test.
Comment 5 Karolin Seeger 2019-05-21 09:34:15 UTC
Pushed to v4-10-test.
Closing out bug report.

Thanks!