Bug 13892 - getline() doesn't expect *n to be random
Summary: getline() doesn't expect *n to be random
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Build (show other bugs)
Version: 4.10.0
Hardware: All AIX
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
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!